Batch file 有关for/f批处理文件的帮助
这是我的密码:Batch file 有关for/f批处理文件的帮助,batch-file,loops,for-loop,overwrite,Batch File,Loops,For Loop,Overwrite,这是我的密码: start /realtime /b /wait .\jampDed.exe for /f "tokens=1-5 delims=:" %%d in ("%time%") do rename .\CIA_Secure_Host2\qconsole.log %%d-%%e-%%f start .\Serv.bat cmd 该批处理应该在窗口中运行程序,当它退出时,应该将文件qconsole.log重命名为当前时间,然后重新启动批处理文件(Serv.bat) 问题是,在我运行批处理
start /realtime /b /wait .\jampDed.exe
for /f "tokens=1-5 delims=:" %%d in ("%time%") do rename .\CIA_Secure_Host2\qconsole.log %%d-%%e-%%f
start .\Serv.bat
cmd
该批处理应该在窗口中运行程序,当它退出时,应该将文件qconsole.log重命名为当前时间,然后重新启动批处理文件(Serv.bat)
问题是,在我运行批处理文件之后,如果我再次尝试运行它,它将不会重命名该文件,这会给我一个错误,告诉我它无法访问该进程,因为它正在使用。如果我尝试编辑批处理文件并在之前运行它之后保存它,我也会遇到同样的错误。如果您打算运行
jamped
,然后重命名其日志文件,并在无限循环中执行此操作,为什么不使用:
@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
而不是摆弄命令文件的递归副本