Au3Builder Posted November 20, 2017 Share Posted November 20, 2017 (edited) I ran into a problem as the title says. #include <AutoItConstants.au3> $Run = Run("cmd.exe" & " /c " & "net stop wuauserv",@SystemDir,@SW_HIDE,$STDOUT_CHILD) ProcessWaitClose($Run) $Output = StdoutRead($Run) MsgBox(0,'',$Output) Edited November 20, 2017 by Au3Builder Earthshine 1 Link to comment Share on other sites More sharing options...
Au3Builder Posted November 20, 2017 Author Share Posted November 20, 2017 (edited) let me clear this up. the msgbox is empty in the above example,does not return anything I'm clueless because when I use ping autoitscript.com in place of net stop wuauserv It can read info from the stream. Edited November 20, 2017 by Au3Builder Link to comment Share on other sites More sharing options...
Developers Jos Posted November 21, 2017 Developers Share Posted November 21, 2017 Maybe the output is returned in STDERR instead? Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Au3Builder Posted November 21, 2017 Author Share Posted November 21, 2017 Theoretically,it should because I started script as user not admin hence I couldnt disable service nonetheless I have already replaced stdout read with stderread,with no success though. Link to comment Share on other sites More sharing options...
Floops Posted November 21, 2017 Share Posted November 21, 2017 Did you also replace $STDOUT_CHILD with $STDERR_CHILD ? Au3Builder 1 Link to comment Share on other sites More sharing options...
funkey Posted November 21, 2017 Share Posted November 21, 2017 Why not use example in help file!!?? #include <AutoItConstants.au3> Local $line Local $Run = Run("cmd.exe" & " /c " & "net stop wuauserv", @SystemDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD) While 1 $line &= StdoutRead($Run) If @error Then ExitLoop WEnd MsgBox(0, "STDOUT read:", $line) $Line = "" While 1 $line &= StderrRead($Run) If @error Then ExitLoop WEnd MsgBox(0, "STDERR read:", $line) Au3Builder 1 Programming today is a race between software engineers striving tobuild bigger and better idiot-proof programs, and the Universetrying to produce bigger and better idiots.So far, the Universe is winning. Link to comment Share on other sites More sharing options...
Au3Builder Posted November 21, 2017 Author Share Posted November 21, 2017 2 hours ago, Floops said: Did you also replace $STDOUT_CHILD with $STDERR_CHILD ? Thanks a lot man. I forgot to change that. By the way. I have difficulty in converting non english characters from output to their proper form. Can you or somebody else help with this matter,please? Link to comment Share on other sites More sharing options...
Au3Builder Posted November 21, 2017 Author Share Posted November 21, 2017 5 hours ago, funkey said: Why not use example in help file!!?? #include <AutoItConstants.au3> Local $line Local $Run = Run("cmd.exe" & " /c " & "net stop wuauserv", @SystemDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD) While 1 $line &= StdoutRead($Run) If @error Then ExitLoop WEnd MsgBox(0, "STDOUT read:", $line) $Line = "" While 1 $line &= StderrRead($Run) If @error Then ExitLoop WEnd MsgBox(0, "STDERR read:", $line) Thanks for pointing it out. I missed this example for some reason. Link to comment Share on other sites More sharing options...
Au3Builder Posted November 21, 2017 Author Share Posted November 21, 2017 The topic can be closed. The proper way to get output from CMD is to use _WinAPI_OemToChar($Output). if you have trouble displaying non english characters Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now