How To Run Linux Style Cron Jobs on Windows
Ever wanted to connect/disconnect the Internet connection at particular times? Want to perform disk defragmentation on weekends when you are not working on your computer? Want to perform backups on 27th of each month?
If you ever wondered how you could achieve that Linux style cron jobs on Windows and tried using the Windows task scheduler you have probably given up hope and have multiple entries to run the same task. On the other hand if you have used the Linux Cron utility you’ll know the power it offers. Bringing similar powers and options to Windows is Z-Cron.
You can download Z-Cron for free here. The download is a zip file, extract and run the setup.
How to Use
Once Z-Cron has been set up, you can begin scheduling tasks with great power and ease. Lets say you keep all your torrent files in one directory and you want to be able to load all the torrent files in that directory in your torrent client for downloading, automatically at 2am on Saturdays and Tuesdays (for whatever reason, here in India we have some broadband plans where data transfer doesn’t count towards the bandwidth cap between 2 am – 8 am, so you can use the following example and change it according to your needs).
Let’s walk through the process:
1. I am using µtorrent in this example. If you use any other torrent client you would have to find the command line options/parameters for your client. For µtorrent it is
µtorrent.exe /directory “<torrent save path>” “<path to torrent file>”
2. Since we want to add all the torrents in a particular directory to the download queue you would have to create a batch file. I won’t get into the details here but here is what you add to the batch file (I am looping through all torrent files and adding them to µtorrent):
FOR %%X IN (*.torrent) DO “C:\Program Files\µtorrent\µtorrent.exe” /directory “D:\Torrent_Downloads” c:\Torrents\%%X
Where C:\Torrents is where I would store .torrent files and D:\Torrent_Downloads is where I want the downloads to be stored. Be careful while using spaces in names of folders or files, it may break the batch file code.
3. Save this file as torrents.bat
4. Start Z-Cron, Click on task (this allows you to create/edit existing tasks)
5. This should open up the Job Settings Window like below. In here you can choose the program/batch file/commands to run and pass arguments to them. Since we already created a batch file in steps 1,2 and 3 we will choose that file here, name our task and provide some description.
6. Click on the scheduler tab and this is where you get the control over scheduling that you can’t even imagine to get with the default Windows Task Scheduler. The screen looks like this:
You can choose to schedule tasks by weeks or months. Check the Weekday under “Period” and you will get the weekly scheduler. Check Tuesday and Saturday.
If however you want greater control you can schedule for specific dates by choosing “Month” as period, which makes it look like this:
You can now do things like making the task run on 27th of every month, last Week of every month, or all Tuesdays of every month, or simply run on 27th February or any other day.
7. So far so good, we have chosen the days we want the task to run, now for the time. Click on scheduler button to bring up a screen like the following:
Hover over the check boxes and see the time change at the bottom, check the appropriate check box, you can select multiple checkboxes to run the task repeatedly.
8. For our torrent download example the screens look like this (remember we want to run it at 2 am on Saturdays and Tuesdays)
That’s it we have scheduled the task to run at 2 am on Tuesdays and Saturdays (notice the calendar on right hand side).
In addition to the control you get in scheduling tasks, you can also use Z-Cron’s built in commands to dial up your connection, move files/ directories, sound alarms, kill processes, monitor programs and many more things effectively removing tedious steps 1, 2 and 3. However if you need something custom, like the example above, you will have hack around a bit!
So how do you like Z-Cron? Do you know of other similar utilities for Windows? Can you think of more constructive ways to use Z-Cron? Share with us in the comments!
Affiliate Disclosure: By buying the products we recommend, you help keep the site alive. Read more.