Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

help with date command in script

Status
Not open for further replies.

lblauen

Technical User
Aug 13, 2002
69
0
0
I'm trying to automate a backup so I wrote a batch file for test. This is for windowsxp.
I will post it here.

set d=%DATE%

copy list.txt %d%.txt

This fails because the date command has / in it and copy dosen't like the /

copy list.txt fri 09/10/2004.txt Fails
I even tryied copy list.txt "fri 09/10/2004".txt still fails but
copy list.txt fri 09102004.txt works fine.

How can I get the date to be 09102004??? Any ideas????
 
for /f "tokens=2-4 delims=/ " %%a in ('DATE /T') do set Date=%%a%%b%%c
copy list.txt %date%.*

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top