batch file help

cuti7399

Platinum Member
Jul 9, 2003
2,583
0
76
Hello all,
I wrote this litte batch file to copy the backup file and rename it to the date which works on xp pcs (date format mon 07/05/2009) but does not work on win98 pcs (date format mon 07-05-2009). Please help, thanks

@echo off

cd\backup

copy backup.tdf temp.tdf

for /f "tokens=1-5 delims=/ " %%d in ("%date%") do rename "temp.tdf" sa24-%%e-%%f-%%g.tdf


:end

exit
 

Ken g6

Programming Moderator, Elite Member
Moderator
Dec 11, 1999
16,472
4,323
75
I'll venture a guess that Win98 doesn't do that kind of for loop. Batch files were a lot less capable back then.

But you could try replacing delims=/ with delims=- and see what happens. Otherwise, VBScript (or maybe even a full-blown C program) would probably work better for your needs.
 

cuti7399

Platinum Member
Jul 9, 2003
2,583
0
76
replacing delims=/ with delims=-
did that already and it gave me a syntax error. the way this system is setup, I can't use other option. I just don't know where the syntax error is. the "for loop"???