The following does not work when running on an NT 4.0 SP6 Server, yet it
works fine on a Windows XP Professional.
@title Backing up Test.txt
@FOR /F "usebackq tokens=2,3,4 delims=/ " %%d IN (`date /t`) DO @FOR /F
"usebackq tokens=5-8 delims=:. " %%t IN (`echo.^|time`) DO @copy
"C:\Temp3\Test.txt" "C:\Temp3\Test_%%f-%%d-%%e_%%th%%um%%vs.txt"
pause
Can someone tell me what i need to do in order to make this run under NT
4.0? This is the error message i get running under
NT:
usebackq tokens=2,3,4 delims =/ " was unexpected at this time.
Basically, all i want is to make backup copies of a certain file with their
date and time attached to their names.
Thank you
usebackq is not a valid parameter in NT. It was added in Win2K. You
shouldn't need it in the example you provided.
@echo off
FOR /F "tokens=2,3,4 delims=/ " %%d IN ('date /t') DO (
FOR /F "tokens=5-8 delims=:. " %%t IN ('echo.^|time') DO (
copy C:\Temp3\Test.txt
C:\Temp3\Test_%%f-%%d-%%e_%%th%%um%%vs.txt))
The last line above will probably wrap. It should start with "copy".
Note that the quotes in the last line aren't needed in this example,
but could be used regardless of the use of "Usebacq"... Usebackq is
only needed if what's inside the parentheses (between the IN and DO)
requires quotes. The "date /t" and "echo. ^|time" do not needs
quotes.
HTH
Clay Calvert
Replace "W" with "L" in email.
I just tried it and it works.