Let the platform do the work

Creating a Batch File to Run Scheduled Jobs (in Microsoft Windows)


You will need a batch file set up in order to run your scheduled jobs in SugarCRM.


Follow these steps to create a batch file: Note: You must be on the server that SugarCRM is running on. Create the batch file.

  • Click Scheduler in the Systems panel of the Admin page.
  • At the bottom of the default screen, you will see the contents of the commands you need to add to a batch file.
  • Open notepad.exe, copy and paste what Sugar's recommendation into a blank file.
  • Change the Save As Type to "dropdown to All Files *.*. " and save it as a .bat file.

Note: This is only a recommendation. It may not work for your particular instance. Check the folder paths because they are often the cause for problems with the Scheduler. It is now time to test the batch file.

  • Open a command window by going to Start --> Run and type in "cmd" without the quotes. Click OK.
  • From the command prompt, type or paste in the first line of the .bat file that you created. Hit Enter. You should now be at your SugarCRM directory. If you see any errors, then you will need to correct the directory path in your .bat file until you are able to successfully change to the directory.
  • Now, type in the second line into the command window. If all is successful, you will have run your scheduler and no errors will be displayed. If you see errors, then you will need to enter in the correct path to where your php.exe file resides. For example:

"C:phpphp.exe" -f cron.php

  • Once you place the correct path of where your php files are, test the above line by typing it into the command window. Be sure to run the first line again to ensure that you are in the SugarCRM directory.
  • If you still receive errors and you are absolutely sure that the directory path to your php.exe file is correct, then change php.exe to php-cgi.exe and test the line again in the command window. Below is an example:

"C:phpphp-cgi.exe" -f cron.php

  • When both lines return with no errors in the command window, add the correct commands into the .bat file. You now know that the contents of your .bat file are correct.