Batch file command question.

G

Guest

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.
 
M

Mark L. Ferguson

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/scriptcenter/learnit.mspx

Basic Scripting:
http://www.microsoft.com/technet/scriptcenter/resources/qanda/basic.mspx

Text Files:
http://www.microsoft.com/technet/scriptcenter/resources/qanda/textfiles.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/scriptcenter/resources/qanda/feb05/hey0223.mspx
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top