Run exe file with parameters in a batch file

user1421214 picture user1421214 · Apr 16, 2014 · Viewed 123k times · Source

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?

Answer

nobody picture nobody · Apr 16, 2014

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.