Date stamping batch file "copy" file
Posted on 2003-03-28
I read several articles on date stamping the output of a batch file "copy" cmd....but was unsure how to apply the fix given. The following:
The syntax you gave would work fine on 2000 but not NT4 as the date/time are not environment variables within NT4.
One caveat to this is you need a space after the / delimiter or it won't skip the day, thus:
for /f "tokens=2-4 delims=/ " %%i in ("%DATE%") do set d=%%k%%i%%j
your line for the time looks fine unaltered.
With NT4, as billious has commented you need to use TIME /T and DATE /T to output the date/time, surrounded by single quotes instead of doubles.
This is to advanced for me. How would apply this if I wanted to use copy c:\text.txt c:\(date).txt?
Could someone help me?