Run a Batch File as a Scheduled Task
Sometimes the most mundane daily tasks can be simplified with a simple batchfile. Say you have a USB drive that you keep your files on that you copy files to several times a day. You could invest in synchronization software, or you could just create a batch file that will copy the files for you. I am paranoid so I like to backup files at least once a day, this is how you setup a scheduled task to run a batch file. If you need help writing a batch file, just leave a comment.
In Windows NT/2000/XP/2003:
1. Go to the Control Panel, and under Scheduled Tasks, select Add Scheduled Task.
2. When asked what program, select Command Prompt.
3. Give it a name and a time to execute.
4. Set the user permissions.
5. On the last page, select open advanced properties.
6. Now adjust the run command adding /q /c “c:\batchfiles\mybatchfile.bat”, mine looks like this:
C:\WINDOWS\system32\cmd.exe /q /c "c:\batchfiles\mybatchfile.bat"
You can now test it out, if it does not run, make sure all the permissions are setup properly.
In Windows Vista, Windows 7, Windows 8, Windows 8.1, Windows 10, Windows Server 2008, Windows Server 2012:
1. Access the Administrative Tools under the Control Panel.
2. Select the Task Scheduler.
3. Select Create Basic Task on Actions menu.
4. Step through the setup.
5. When asked for action, select Start a program
6. Select Browse, then find cmd.exe in the Windows/system32 folder.
7. Under Add arguments, add the following:
/q /c "c:\batchfiles\mybatchfile.bat"
4 comments command line, Microsoft, Server 2008, Server 2012, Server 2016, Windows 10, Windows 2000, Windows 7, Windows 8, Windows NT, Windows Vista, Windows XP
I tried the solution suggested but it did not work , even though when running the .bat file it is executed successfully
You forgot to place the script in quotes
C:WINDOWSsystem32cmd.exe /c /q “path to your script.bat”
/c is to start a new instance of the script
/q is to not display anything on the scree or “Silent”
Done …….. Thanks
1 Trackbacks / Pingbacks
[…] Server 2012 R2, but they are applicable to most newer versions of Windows. This is similar to the post I made many years ago but with some additions mainly around the commands you need to find files […]
Leave a reply