DEV Community

loading...

Schedule a job on Windows

dnsmnds profile image Dênis Mendes ・1 min read

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

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

Discussion (0)

pic
Editor guide