Sign in to follow this  
Followers 0
hellAT

no output from run command

5 posts in this topic

Hello,

i have a strange problem. Several PC are running a script where i use "ipconfig /all" to get some in. My original script looks like this:

$stream = Run(@ComSpec & " /c ipconfig /all", '', @SW_HIDE, 2)

While 1

$line = StdoutRead($stream)

$cmdreturn &= $line

If @error Then ExitLoop

WEnd

On two PCs i do not get any result, means $cmdreturn=""

So does someone have an idea why the return value is empty?!? For me, it seems that all PCs are installed in the same way (WinXp Prof, same patchlevel etc). If i open an DOS Box and run "cmd /c ipconfig /all" it looks fine.

thanks in advance / karsten

Share this post


Link to post
Share on other sites



Have you included Constants.au3?

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Your error test is at the wrong place:

$cmdreturn=""
$stream = Run(@ComSpec & " /c ipconfig /all", '', @SW_HIDE, 2)
while 1
    $line = StdoutRead($stream)
    If @error Then ExitLoop
    $cmdreturn &= $line
WEnd
ConsoleWrite('@@ (9) $cmdreturn = ' & $cmdreturn & @CRLF);### Debug Console

Not sure if thats the real problem, you could also capture the STDERR to see if there is any error message displayed....

Edited by Jos

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Have you included Constants.au3?

in script its there, yes. But where do you see the need in this small example?

Share this post


Link to post
Share on other sites

Your error test is at the wrong place:

$cmdreturn=""
$stream = Run(@ComSpec & " /c ipconfig /all", '', @SW_HIDE, 2)
while 1
    $line = StdoutRead($stream)
    If @error Then ExitLoop
    $cmdreturn &= $line
WEnd
ConsoleWrite('@@ (9) $cmdreturn = ' & $cmdreturn & @CRLF);### Debug Console

Not sure if thats the real problem, you could also capture the STDERR to see if there is any error message displayed....

A short question to ConsoleWrite. My way is to compile the script and then send the exe to the User by mail. Is there a way, to direct the Output to textfile or Popup?

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