So i have this script schedule.php that i want to run at every 5 minutes. The script checks for something, modifies the database and sends some mails.I have WAMP server on windows 7 ultimate. I tried using windows scheduler but i think it only works for windows server and cron jobs works only for linux.
Asked
Active
Viewed 3,341 times
0
-
What I found in Google for you by words "cron windows": First link: [CRONw - CRON for Windows](http://cronw.sourceforge.net/), Second: [Configuring cron jobs on Windows | drupal.org](http://drupal.org/node/31506) – OZ_ Jun 19 '11 at 12:20
-
Just checking if this worked for you and if you can accept the answer as a valid one. This should have gotten you through the task you were involved in, but if there were any problems I'd be curious to know what you wound up implementing. – Liam Sep 09 '11 at 02:56
2 Answers
1
I made a bat file containing this line
C:\wamp\bin\php\phpYOURVERSION\php-win.exe -f C:\wamp\www\PATHTOYOURSCRIPT.php
Then I scheduled this bat file to run on my desired schedule in the windows scheduler.

Steven
- 61
- 1
- 3
- 13
1
There are a few ways to do this, one of the ways I have succeed in the past was to make a .bat file or a PowerShell (.ps) file which can be invoked by the Windows as a Scheduled Task. I prefer this method since, on the Windows platform, you get the GUI of all your Tasks in one location and it is easy to keep track of them.
The quick and dirty solution can be found for PowerShell in this StackOverflow article but I'll paste the solution here as well:
$WshShell = new COM("WScript.Shell");
$oExec = $WshShell->Run("C:\wamp\bin\php\phpVERSIONNUMBER\php-win.exe -f C:/wamp/www/path/to/backgroundProcess.php", 0, false);
Hope this is helpful and gets you headed in the right direction.
-
Thank you but, unfortunately, windows scheduled tasks can only be performed daily and i need my task to be run at every 5 minutes interval. – ionescho Jun 19 '11 at 13:26
-
@user783476 -- that is NOT true. Windows scheduler allows execution of task with 1 minute interval. I assume you are using Windows XP -- there is only shows 1-per-day option, but when you edit the task and click "Advanced" button on "Schedule" tab, you will be specify more specific intervals. – LazyOne Jun 19 '11 at 14:34