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?
Create Batch File to Run EXESave your file with the file extension . bat , e.g. run-exe-program. bat and double click on it to run the .exe program.
You can test command line arguments by running an executable from the "Command Prompt" in Windows or from the "DOS prompt" in older versions of Windows. You can also use command line arguments in program shortcuts, or when running an application by using Start -> Run. This will start notepad with a blank document.
Use double percent signs ( %% ) to carry out the for command within a batch file. Variables are case sensitive, and they must be represented with an alphabetical value such as %a, %b, or %c. ( <set> ) Required. Specifies one or more files, directories, or text strings, or a range of values on which to run the command.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With