Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
I'm trying to copy files from one server to another using a batch file..
the batch file runs every morning at 7:00 ..
I use winat to automat this batch file to run evey morning..this is what I got
Copy \\appnt4\backups\current\data d:\prgra~1\service\data /q
but it never runs thru winat.... If I manualy run the batch file from a dos window it works..any ideas??? why its not working???

the batch starts up. fine..but when it gets to the copying portion of the batch file it doesn't do anything...... it by passes it and goes on to the rest of the batch file...
I have also tried using net use...nothing works.. here is a sample of the batch file
@echo off:: Set the debugging code.
set zTrace=no
set zDisplay=^>NUL^: 2^>^&1
set zPause=
if /I "%zTrace%" EQU "yes" (@echo on & set zDisplay= & set zPause=@pause)
set zMJTempLog=C:\Scripts\MJTempAT.log
set zMJLog=C:\Scripts\MaintenanceJobReports.log
set zPgmLoc=D:\Progra~1
set zLFScanLog=%zPgmLoc%\Servic~2\Logs\lfscan.log
set zReboot=nocall c:\scripts\GetDateTime.cmd
echo %DT_YEAR%/%DT_MONTH%/%DT_DOM% (%DT_DOW%) @ %DT_HOUR%:%DT_MIN%:%DT_SEC% - ServiceCenterReports Maintenance Job - Started > %zMJTempLog%
------------------
::
:: Stop the Services.
::set zAppDir=%zPgmLoc%\Servic~2
net stop "ServiceCenterReports" /yes %zDisplay%
if "%errorlevel%" EQU "0" (echo The "ServiceCenterReports" NT Service was successfully stopped.) >> %zMJTempLog%
if "%errorlevel%" NEQ "0" (echo The "ServiceCenterReports" NT Service could not be stopped. The return code was: "%errorlevel%".
echo Processing is continuing.) >> %zMJTempLog%net stop "SCAutomate Pager" /yes %zDisplay%
if "%errorlevel%" EQU "0" (echo The "SCAutomate Pager" NT Service was successfully stopped.) >> %zMJTempLog%
if "%errorlevel%" NEQ "0" (echo The "SCAutomate Pager" NT Service could not be stopped. The return code was: "%errorlevel%".
echo Processing is continuing.) >> %zMJTempLog%
set zAppDir=%zPgmLoc%\Servic~1net stop "ServiceCenter" /yes %zDisplay%
if "%errorlevel%" EQU "0" (echo The "ServiceCenter" NT Service was successfully stopped.) >> %zMJTempLog%
if "%errorlevel%" NEQ "0" (echo The "ServiceCenter" NT Service could not be stopped. The return code was: "%errorlevel%".
echo Processing is continuing.) >> %zMJTempLog%
set zAppDir=%zPgmLoc%\Servic~3net stop "ServiceCenterAT" /yes %zDisplay%
if "%errorlevel%" EQU "0" (echo The "ServiceCenterAT" NT Service was successfully stopped.) >> %zMJTempLog%
if "%errorlevel%" NEQ "0" (echo The "ServiceCenterAT" NT Service could not be stopped. The return code was: "%errorlevel%".
echo Processing is continuing.) >> %zMJTempLog%
------------------
::
:: Copy production backup files into ServiceCenterReports (Development Server) and replace
:: existing data
::del %zPgmLoc%\Servic~2\data\*.* /q
xcopy \\appnt4stha13\backups\current\data\*.* %zPgmLoc%\Servic~2\data\ /q------------------
::
:: Start the Services.
::if /I "%zReboot%" EQU "yes" (goto :End)
net start "ServiceCenter" %zDisplay%
if "%errorlevel%" NEQ "0" (goto :error1)
echo The "ServiceCenterReports" NT Service was successfully started. >> %zMJTempLog%net start "SCAutomate Pager" %zDisplay%
if "%errorlevel%" NEQ "0" (goto :error2)
echo The "SCAutomate Pager" NT Service was successfully started. >> %zMJTempLog%net start "ServiceCenterAT" %zDisplay%
if "%errorlevel%" NEQ "0" (goto :error1)
echo The "ServiceCenterReports" NT Service was successfully started. >> %zMJTempLog%net start "ServiceCenterReports" %zDisplay%
if "%errorlevel%" NEQ "0" (goto :error1)
echo The "ServiceCenterReports" NT Service was successfully started. >> %zMJTempLog%goto :End
------------------
::
:: The error processing.
:::error1
echo Error: The "ServiceCenter" NT Service could not be started. >> %zMJTempLog%
echo Error: The "ServiceCenterAT" NT Service could not be started. >> %zMJTempLog%
echo Error: The "ServiceCenterReports" NT Service could not be started. >> %zMJTempLog%
goto :End
------------------
::
:: Termination.
:::End
call c:\scripts\GetDateTime.cmd
echo %DT_YEAR%/%DT_MONTH%/%DT_DOM% (%DT_DOW%) @ %DT_HOUR%:%DT_MIN%:%DT_SEC% - ServiceCenterReports Maintenance Job - Ended >> %zMJTempLog%
echo. >> %zMJTempLog%:: Add the current log info to the top of the running log file.
copy %zMJTempLog%+%zMJLog% %zMJTempLog%
type %zMJTempLog% > %zMJLog%
del %zMJTempLog% /q%zPause%
:: DO NOT ADD ANY CODE AFTER THE :EOF LABEL!
:EOF

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |