1.

Solve : DOS filerename error?

Answer»

I am getting the following error message:

"BULK BILL.dsi" BULKBILL 834.dsi
The syntax of the command is incorrect.

This is the code that i am using
for /f "tokens=1-4 delims=:" %%d in ("%time%") do rename "BULK BILL.dsi" BULKBILL%%d%%e.dsi

This worked FINE yesterday afternoon several times. The only differnce is that las night the code was producing a FILENAME such as the ones below with the last four chars representing the hour and minute:
BULKBILL1702
BULKBILL1710
BULKBILL1807

Today the code is producing a filename that has a SPACE between the name and the timestamp, such as the error above shows.

Any IDEAS are appreciated.correction to the code:
for /f "tokens=1-5 delims=:" %%d in ("%time%") do rename "BULK BILL.dsi" BULKBILL%%d%%e.dsi

I had a 4 in place of the 5 for the tokens. However, it still does not work when i change the tokens to 5.Code: [Select]@echo off
for /f "tokens=1-2 delims=:" %%a in ("%time%") do (
ren "BULK BILL.dsi" "BULKBILL%%a%%b.dsi"
)



Discussion

No Comment Found