Tom's Hardware > Forum > Windows XP > Windows XP General Discussion > Batch file command question.

Batch file command question.

Forum Windows XP : Windows XP General Discussion - Batch file command question.

Tom's Hardware: Over 1.4 million members in 6 different countries available to answer all your high-tech questions. Sign up now! Its free!
Word :    Username :           
 

Archived from groups: microsoft.public.windowsxp.help_and_support (More info?)

 

I'm trying a copy command but I want the resulting file to be named today's
date. For example:

I have 6 .txt files in a folder C:\test

I want to combine all six files and rename the result with today's date in a
different location, say C:\import

My batch command would start:

copy C:\test\*.* C:\import\[date].txt

I need to know how to get that date to appear as the file name. I tried
that %~t1 thing and couldn't get anywhere with it.

Any help would be appreciated.
--
Justin

Sponsored Links
Register or log in to remove.

Archived from groups: microsoft.public.windowsxp.help_and_support (More info?)

 

Batch commands are a bit limited to do what you want, but scripting will do it easily, if you can get past the basics of scripting,
and read a few examples of file manipulation.

Learn to Script:
http://www.microsoft.com/technet/s [...] arnit.mspx

Basic Scripting:
http://www.microsoft.com/technet/s [...] basic.mspx

Text Files:
http://www.microsoft.com/technet/s [...] files.mspx

How Can I Read Text From a File and Then Rename the File Using the Text I Just Read?:
http://www.microsoft.com/technet/s [...] y0223.mspx


--
Mark L. Ferguson
FAQ for Windows Antispy http://www.geocities.com/marfer_mvp/FAQ_MSantispy.htm
"jrozen" <jrozen@discussions.microsoft.com> wrote in message news:EE80A52B-323C-4E99-89E0-FFA694606E92@microsoft.com...
> I'm trying a copy command but I want the resulting file to be named today's
> date. For example:
>
> I have 6 .txt files in a folder C:\test
>
> I want to combine all six files and rename the result with today's date in a
> different location, say C:\import
>
> My batch command would start:
>
> copy C:\test\*.* C:\import\[date].txt
>
> I need to know how to get that date to appear as the file name. I tried
> that %~t1 thing and couldn't get anywhere with it.
>
> Any help would be appreciated.
> --
> Justin

Reply to Anonymous
Tom's Hardware > Forum > Windows XP > Windows XP General Discussion > Batch file command question.
Go to:

There are 972 identified and unidentified users. To see the list of identified users, Click here.

Please mind

You are about to answer a thread that has been inactive for more than 6 months.
If you still wish to proceed, please ensure that your posting is original and does not duplicate or overlap any prior responses to this thread.

Add a reply Cancel
Sponsored links
  • Ask the community now
  • Publish
Ad
They won a badge
Join us in greeting them