Maximus said:
Sorry, the thing I am doing is that I am running Printmig from a w2k
workstation. I assume you know that program.
I made this batfile with this line: printmig -b
\\servername\Backup\%date%.cab \\servername. It will generate a cabfile.
When I was running it from a XP workstation the output file was namned
2004-11-08.cab
From a w2k workstation the file get a different name Thu.cab.
So when I type date in cmd.exe I get 2004-11-08 in XP and in a w2k
workstation I get Thu 2004-11-08. So basically the %date% in w2k grabs the
thu instead of the date itself. I hope you understand this time.
Thank you.
Regards
Henrik
I am not familiar with printmig.
The default value for %date% is dow dd/mm/yy. The order of the
date components can vary, as can the the separator. It could be
a slash, a dash or some other character. The slash would cause
some obvious problems in your batch file.
If you want a really robust batch file that is independent of any
regional settings then you should use something along these
lines:
1 @echo off
2 for /F "tokens=1-5" %%a in ('now.exe') do set MyDate=%%a-%%c-%%b-%%e
3 printmig -b \\servername\Backup\%MyDate%.cab \\servername
For a band-aid solution you could do this:
1 @echo off
2 set MyDate=%date%
3 ver | find /i "Windows 2000" && for /F "tokens=2" %%a in ('echo %date%')
do set MyDate=%date%
4 printmig -b \\servername\Backup\%MyDate%.cab \\servername
The second solution will fail on machines that have different
regional data format settings.
now.exe is included with the Win2000 Resource Kit. I'm sure you
can download freeware versions from the net.
Line numbers are for clarity only. Remove them before running
the batch file.