DEV Community

Dênis Mendes
Dênis Mendes

Posted on • Updated on

Schedule a job on Windows

Hey there!

I use macOS on a daily basis but I'm working into a multi-platform application which runs on Windows and Linux then I needed to schedule a job the first time on Windows and I found that application called Schtasks.exe that helps to create and manage schedule jobs into Windows.

So if you wanna schedule a job to run every 5 minutes you can run that command line on terminal:

schtasks /create /sc minute /mo 5 /tn "Open MyProgram" /tr "c:\Users\admin\AppData\Local\Programs\myprogram.exe"
Enter fullscreen mode Exit fullscreen mode

And then if you want to stop that schedule job you can run:

schtasks /delete /tn "Open MyProgram"
Enter fullscreen mode Exit fullscreen mode

UPDATE #1:

If you want to force a command line above so use /f at the end of the command line.

There are many other parameters and you can see here: https://docs.microsoft.com/en-us/windows/win32/taskschd/schtasks

https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/schtasks

https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/schtasks-create

Top comments (0)