run exe from web page?
I want to make a web page that lunches an exe on the server when loaded i tried php:
exec('filename');
What code did you use in .NET to execute exe? You should use Process class - check MSDN - it also gives an example as to how to use the class to execute the exe. The class allows lot of option such as redirecting standard i/p, o/p. You can even use WaitForExit method to wait till the process is complete.
I've done the same thing using PHP:
exec('cmd.exe /c yourexename.exe',$data,$ret);
where $data
is output array and $ret
will retur 0 for successful execution and 1 for failure.
If you're just looking for any language that has that capability, I know coldfusion can do that using:
<cfexecute
name="ApplicationName"
arguments="CommandLine Arguments"
OUTPUTfile="Output file name"
timeout="Timeout interval in seconds">
exec();
system();
Allows you to execute external programs and get the console output
精彩评论