php has a function called system where you can call system commands and executables, for example system('uptime')
Is there something like that for ASP? I'd like to show the output of the 'uptime -a' on windows 2003 server in a webpage.
System.Diagnostics has process-handling classes that let you deal with outside executables.
That seems like an odd place for it.
Something like this is how you would use it in C# (implies ASP.NET, not plain ASP). You'll need to add using lines for System.Diagnostics and System.IO, too:
Process proc = new Process();
proc.StartInfo.FileName = "uptime.exe";
proc.StartInfo.Arguments = "-a";
proc.StartInfo.UseShellExecute = false;
proc.StartInfo.RedirectStandardOutput = true;
StreamReader sw = proc.StandardOutput;
string myString = sw.ReadToEnd();
Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation, please create a new thread in our Forums, or Contact Us and let us know.