Hi all,
I am using PHP in Windows XP.I want to run a shell script which generates an output file, using System function.How can I implement it?
I have tried in the following way(And open the php page using IE.).
for example:
system('echo "I like PHP" > output' ,$retval);
It is not creating any file.
But if i do like " system('echo "I like PHP"',$retval); " then it is printing fine on IE.
Can you please guide me.
Thanks in advance,
Uday.
How to run a shell script in PHP(windows) URGENT!!!
Moderator: General Moderators
exec() maybe
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
I'm aware of the fact that php - cmd.exe interop isn't very clear..
According to Windows cmd specifications the quotes are needed if one of the special characters is present in the command line.
The special characters that require quotes are: <space>&()[]{}^=;!'+,`~
Two sets of quotes are needed. Like this:
$result = `""c:\\program files\\some program\\prog.exe" "filename""`;
This won't work:
$result = `"c:\\program files\\some program\\prog.exe" "filename"`;
According to Windows cmd specifications the quotes are needed if one of the special characters is present in the command line.
The special characters that require quotes are: <space>&()[]{}^=;!'+,`~
Two sets of quotes are needed. Like this:
$result = `""c:\\program files\\some program\\prog.exe" "filename""`;
This won't work:
$result = `"c:\\program files\\some program\\prog.exe" "filename"`;
- dibyendrah
- Forum Contributor
- Posts: 491
- Joined: Wed Oct 19, 2005 5:14 am
- Location: Nepal
- Contact:
use shell_exec to execute in shell
use the shell_exec to execute the process in the shell.
in linux,
in windows,
I haven't tested in windows, but this might be the correct syntax.
Dibyendra
in linux,
Code: Select all
$output_from_proc = shell_exec("/path/to/command");Code: Select all
$output_from_proc = shell_exec("Drive_Letter:\\PATH\\TO\\Program.exe");Dibyendra