-
August 12th, 2009, 08:07 AM
#1
Getting ouput from Process.Start() in Vista
Hello!
I want to call a php-script out of a C#-Application and get the output of the php-script as result:
Code:
// Call PHP
System.Diagnostics.Process proc = new System.Diagnostics.Process();
proc.StartInfo.FileName = sPathToPhp+"php.exe";
proc.StartInfo.Arguments = sScript + " " + sParameter;
proc.StartInfo.UseShellExecute = false;
proc.StartInfo.RedirectStandardOutput = true;
proc.StartInfo.CreateNoWindow = true;
proc.Start();
proc.WaitForExit();
String sOutput = proc.StandardOutput.ReadToEnd();
proc.Close();
This works fine in XP, but in Vista, sOutput keeps empty - any ideas what could be wrong?
-
August 12th, 2009, 12:49 PM
#2
Re: Getting ouput from Process.Start() in Vista
Check if it's a permissions issue. As a test, run the app as an administrator (or if you are debugging, run Visual Studio as an admin).
-
August 12th, 2009, 01:21 PM
#3
Re: Getting ouput from Process.Start() in Vista
Thanks for your reply. I found out that it's because of the space in "program files" - you have to put the paramters in " to make it work.
-
August 12th, 2009, 01:49 PM
#4
Re: Getting ouput from Process.Start() in Vista
Originally Posted by martho
Thanks for your reply. I found out that it's because of the space in "program files" - you have to put the paramters in " to make it work.
But you would have to do that in XP as well...
-
August 12th, 2009, 03:28 PM
#5
Re: Getting ouput from Process.Start() in Vista
Thats true, but we use XP and Vista in German Versions. So in XP it's language-dependend ("Programme"), but in Vista it's "Program Files" no matter which language you have. Thats why I didn't encounter the problem in my XP.
Last edited by martho; August 12th, 2009 at 03:31 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|