Sign in to follow this  
Followers 0
Matti

Get STDOUT/ERR from ShellExecute?

5 posts in this topic

Hi

I need ShellExecute to execute a program with admin rights (Run() doesn't work for that), but I'd also need the programs output somehow.. How can I get it?

there's no PID for StdOutRead() and also shell redirection doesn't seem to work:

ShellExecuteWait("prog.exe", "> c:\tmp\test.out 2>&1", @WorkingDir, "runas")

There's nothing written to that file (nor is it created)

Is there a way to achieve that?

Thanks

Matt

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

whatever Edited by MvGulik

"Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions."
"The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014)

"Believing what you know ain't so" ...

Knock Knock ...
 

Share this post


Link to post
Share on other sites

I thought this answer would come and I think you're talking about the RunAs function which WOULD do what I want IF I knew all user's of this world's passwords.

As a matter of fact I need to activate the UAC Prompt, not RunAs a specific user with password, so any Run* Func will not do.

The only way to do it (as also specified by MS TechNet) is using ShellExecute with the (undocumented in the AutoIT docu) "runas" verb which doesn't need a specific username+password on vista/7 but should prompt the user to obtain admin rights

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

whatever Edited by MvGulik

"Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions."
"The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014)

"Believing what you know ain't so" ...

Knock Knock ...
 

Share this post


Link to post
Share on other sites

Now the only option I see here is to create your own IO process between caller and called process.

There might be more than one way, Others might know.

I can only thing of using files to pass information from and to the two processes.

Is that the core problem?

Yes basically it is, I need to get the output of the called program. But since that doesn't seem to be possible in an easy way (and I've got the called program under my control), I guess I'll revert to using files written by the called process itself instead of the more convenient STDOUT like I had it before when using Run*()

Matt

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0