Please have a look at my batch file.
echo off
start "c:\program files\php\php.exe D:\mydocs\mp\index.php param1 param2"
but it isn't working. Any ideas how do I get it working?
This question is related to
php
windows
batch-file
scheduled-tasks
Unless it's just a simplified example for the question, my advice is that drop the batch wrapper and schedule PHP directly, more specifically the php-win.exe
program, which won't open unnecessary windows.
Program: c:\program files\php\php-win.exe
Arguments: D:\mydocs\mp\index.php param1 param2
Otherwise, just quote stuff as Andrew points out.
In older versions of Windows, you should be able to put everything in the single "Run" text box (as long as you quote everything that has spaces):
"c:\program files\php\php-win.exe" D:\mydocs\mp\index.php param1 param2
If you need to see the output of the execute, use CALL
together with or instead of START
.
Example:
CALL "C:\Program Files\Certain Directory\file.exe" -param
PAUSE
This will run the file.exe and print back whatever it outputs, in the same command window. Remember the PAUSE
after the call or else the window may close instantly.
This should work:
start "" "c:\program files\php\php.exe" D:\mydocs\mp\index.php param1 param2
The start
command interprets the first argument as a window title if it contains spaces. In this case, that means start
considers your whole argument a title and sees no command. Passing ""
(an empty title) as the first argument to start
fixes the problem.
Source: Stackoverflow.com