devxlogo

Schedule a Batch File

Schedule a Batch File

Question:
I need to schedule a batch file to automatically run at night. I have tried every variation of the “AT” command from a command line on the Windows NT Server (NT4) and it will not execute the batch file.

If I run the batch file manually from the command line, everything works just fine. What I entered for the “AT” command was: at 7:30 /next:Th cmd /c c:atchfilename.cmd

I’ve tried with and without quotation marks around the path & file name AND tried including the cmd portion inside the quotation marks AND using cmd.exe AND every other variation I could think of. Nothing works. What is the correct format? I’ve even gone to the Microsoft site and tried what they state is the proper syntax?it didn’t work

begin batch file:@echo offrem delete any current share using drive letter Enet use e: /deleterem create a share to the datanet use e: \scsm1d$ password /user:domainaccountrem jump to the folder the data will be xcopied toh:cdscsm1.bakrem delete all existing files in the foldererase *.* /f/q/srem copy all files in all subdirectories even if errorsxcopy e:public /s/e/v/r/h/q/cend batch file

Any help would be greatly appreciated.

Answer:
Yep, I know exactly what is happening. From the command line, the batch file is running under your security account?from the AT schedule command, it is running in the context of the System Account. The System account has 100% rights on the local machine, and 0% rights to use network services. So, when you are trying to work with commands that are going through the network director, it will fail.

Try running the Schedule Service under your logon and see if it doesn’t magically work.

devx-admin

Share the Post: