我创建了 2 个简单的 bat 文件,但我不断收到相同的错误。我想将 bat 文件中的内容记录到文本文档中。错误是:The process cannot access the file because it is being used by another process.
是因为我被称为本身的bat文件吗?
代码 1
@echo off
:BEGIN
net stop redmineMongrel1
TIMEOUT /T 15
net start redmineMongrel1
goto SUCCESS
:SUCCESS
"C:\Documents and Settings\Administrator\My Documents\MongrelRestartScript.bat" > "C:\Documents and Settings\Administrator\My Documents\MongrelRestart.log"
ECHO Mongrel Restart Successful %DATE%>> "C:\Documents and Settings\Administrator\My Documents\MongrelRestart.log"
goto END
:FAIL
ECHO.>"C:\Documents and Settings\Administrator\My Documents\MongrelRestart.log"
ECHO Mongrel Restart FAILED %DATE%>> "C:\Documents and Settings\Administrator\My Documents\MongrelRestart.log"
:END
echo END OF BAT FILE
代码 2
@echo off
:BEGIN
DEL "D:\BACKUPS\RedmineFolder" /s /q
RD "D:\BACKUPS\RedmineFolder" /s /q
xcopy C:\BitNami\apps\redmine "D:\BACKUPS\RedmineFolder" /e /h /r /y /I
goto SUCCESS
:SUCCESS
ECHO.>"C:\Documents and Settings\Administrator\My Documents\RedmineBackupLog.log"
ECHO Redmine Backup Successful %DATE%>> "C:\Documents and Settings\Administrator\My Documents\RedmineBackupLog.log"
"C:\Documents and Settings\Administrator\My Documents\RedmineBackUpScript.bat" >> "C:\Documents and Settings\Administrator\My Documents\RedmineBackupLog.log"
goto END
:FAIL
ECHO.>"C:\Documents and Settings\Administrator\My Documents\RedmineBackupLog.log"
ECHO Redmine Backup FAILED %DATE%>> "C:\Documents and Settings\Administrator\My Documents\RedmineBackupLog.log"
:END
echo END OF BAT FILE