Link to home
Start Free TrialLog in
Avatar of crompnk
crompnkFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Incorrect syntax

Hi,

When I run the attached bat file with batch commands I sometimes get the following error and the file isn't renamed:

'The syntax of the command is incorrect'

I don't always get this error, the syntax is correct, I need to restart the computer for it to work again.
Can anything be done to solve this.

Thank you
TestFile.bat.txt
ASKER CERTIFIED SOLUTION
Avatar of Lee W, MVP
Lee W, MVP
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Also, I don't know if REN supports PATHs... I'd suggest CDing into the folder then running ren on JUST the file name.
ren "C:\Temp\Test\TestFile.txt" "TestFile_%Date:/=-%_%Time::=-%.txt"
type nul >"C:\Temp\Test\TestFile.txt"
t0t0... isn't that what I said?
leew,
FYI, REN supports path (in the source part only, the destination may not contain path info).


leew - probably, I didn't look, but if it is then it's confirmed then isn't it? Two experts in agreement can't be wrong can they eh? :)


@Qlemo,

Didn't test it today - obviously it would've been easy enough to test.  But that probably explains why I wasn't remembering exactly...

@t0t0.

I have no problem with people posting confirmations... and I have no problem with people posting the same thing (essentially) at (generally) the same time... once recently there was a question answered by 4 people with the same answer during the same minute... but when people post 30 minutes after I do and fail to acknowledge my comment, that's inappropriate in my opinion.