J
JohnB
Guest
Re: Another batch file question
Well it worked when I ran it live. But it didn't work when I ran it in
Scheduled Tasks. And I can not figure out why. I copied the beginning of
the batch file below. It copies about 10 folders, only 1 is shown there.
It seemed to have failed at the very beginning. There was no folder with
the current date. It never got created. Which would explain why the rest
of it failed. So I created a test batch file that only creates the folder.
Ran it in scheduled tasks, and wouldn't you know, it worked fine.
Any ideas?
I'm totaly stumped on this one.
TIA
"Pegasus (MVP)" <I.can@fly.com.oz> wrote in message
news:u7NWRc32IHA.1204@TK2MSFTNGP04.phx.gbl...
> Thanks for the feedback.
@Echo off
REM
REM Copy files from MainServer to TeraServer
REM Set variable to current date
set MyDate=%date:~4,2%%date:~7,2%%date:~-2%
REM Create a subfolder with today's date as the name
MD t:\%MyDate%
REM Backup folder: Folder1
echo Started backup of Folder1 at %time%, %date% > BackupLog.txt
xcopy /s /e /i /q /y d:\Folder1 "t:\%MyDate%\Folder1" >> BackupLog.txt
echo Finished Folder1 at %time%, %date% >> BackupLog.txt
echo. >> BackupLog.txt
Well it worked when I ran it live. But it didn't work when I ran it in
Scheduled Tasks. And I can not figure out why. I copied the beginning of
the batch file below. It copies about 10 folders, only 1 is shown there.
It seemed to have failed at the very beginning. There was no folder with
the current date. It never got created. Which would explain why the rest
of it failed. So I created a test batch file that only creates the folder.
Ran it in scheduled tasks, and wouldn't you know, it worked fine.
Any ideas?
I'm totaly stumped on this one.
TIA
"Pegasus (MVP)" <I.can@fly.com.oz> wrote in message
news:u7NWRc32IHA.1204@TK2MSFTNGP04.phx.gbl...
> Thanks for the feedback.
@Echo off
REM
REM Copy files from MainServer to TeraServer
REM Set variable to current date
set MyDate=%date:~4,2%%date:~7,2%%date:~-2%
REM Create a subfolder with today's date as the name
MD t:\%MyDate%
REM Backup folder: Folder1
echo Started backup of Folder1 at %time%, %date% > BackupLog.txt
xcopy /s /e /i /q /y d:\Folder1 "t:\%MyDate%\Folder1" >> BackupLog.txt
echo Finished Folder1 at %time%, %date% >> BackupLog.txt
echo. >> BackupLog.txt