Help with for /f batch file
heres my code:
start /realtime /b /wait .\jampDed.exe
for /f "tokens=1-5 delims=:" %%d in ("%time%") do rename开发者_Go百科 .\CIA_Secure_Host2\qconsole.log %%d-%%e-%%f
start .\Serv.bat
cmd
this batch is supposed to run the program in a window, and when it quits, is supposed to rename the file qconsole.log to the current time, and then relaunch the batch file (Serv.bat).
problem is, after i run the batch file, if i try to run it again, it wont rename the file, giving me an error saying that it could not access the process because it is in use. i also get the same error if i ty to edit the batch file and save over it after previously running it.
If your intent is to run jampDed
, then rename its log file, and do that in an infinite loop, why not just use:
@echo off
:again
start /realtime /b /wait .\jampDed.exe
for /f "tokens=1-5 delims=:" %%d in ("%time%") do rename .\CIA_Secure_Host2\qconsole.log %%d-%%e-%%fs
goto :again
instead of fiddling around with running recursive copies of the command file.
精彩评论