fcjoe Posted August 28, 2010 Share Posted August 28, 2010 Hello,I'm trying to get the output from running a command. I copied the example from AutoIt's help file but I keep getting an error: Unable to get console input mode - 0x80070006 The handle is invalidI'm trying to run the Bitsadmin.exe program. BitsadminIf I change the command line and remove the "/getstate test" I get the output without any errors. But if I add any options to the command line I get the same error. The error message comes from StdoutRead, StderrRead doesn't return anything.My code is below.Thanks,Joe#include <Constants.au3> $foo = Run(@ComSpec & " /c C:\bitsadmin.exe /getstate test", @SystemDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD) While 1 $line = StdoutRead($foo) If @error Then ExitLoop MsgBox(0, "STDOUT read:", $line) Wend While 1 $line = StderrRead($foo) If @error Then ExitLoop MsgBox(0, "STDERR read:", $line) Wend MsgBox(0, "Debug", "Exiting...") Link to comment Share on other sites More sharing options...
wakillon Posted August 28, 2010 Share Posted August 28, 2010 Sometimes certain command line utility give nothing in output.I think bitsadmin is in this case... AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Link to comment Share on other sites More sharing options...
fcjoe Posted August 28, 2010 Author Share Posted August 28, 2010 Sometimes certain command line utility give nothing in output. I think bitsadmin is in this case... It does give output, it even has option flags to make the output easier to read for parsing (/RAWRETURN] [/WRAP | /NOWRAP) Link to comment Share on other sites More sharing options...
wakillon Posted August 28, 2010 Share Posted August 28, 2010 (edited) It does give output, it even has option flags to make the output easier to read for parsing (/RAWRETURN] [/WRAP | /NOWRAP) #include <Constants.au3> $_bitsadminPath = 'C:\bitsadmin.exe' $_Pid = Run ( @ComSpec & ' /c "' & $_bitsadminPath & '" /getstate test', @SystemDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD ) While ProcessExists ( $_Pid ) $line = StdoutRead ( $_Pid ) If Not @error And $line = '' Then $line = StdoutRead ( $_Pid, True, True ) If Not @error And $line <> '' Then ConsoleWrite ( "STDOUT read : " & $line & @Crlf ) $line = StderrRead ( $_Pid ) If Not @error And $line = '' Then $line = StderrRead ( $_Pid, True, True ) If Not @error And $line <> '' Then ConsoleWrite ( "STDERR read : " & $line & @Crlf ) Wend I get "STDOUT read : Unable to get console input mode - 0x80070006 Descripteur non valide" Perhaps parameters are wrong ? Edited August 29, 2010 by wakillon AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Link to comment Share on other sites More sharing options...
fcjoe Posted August 28, 2010 Author Share Posted August 28, 2010 I changed the code to this $foo = Run(@ComSpec & " /c C:\bitsadmin.exe /rawreturn /getstate test > c:\line.txt","C:\",@SW_MINIMIZE) The only thing I changed was adding " > c:\line.txt" to the end of the command. The output went to the text file correctly. If I addedd $STDERR_CHILD + $STDOUT_CHILD optional flags, then the text file would have the "Unable to get console input mode - 0x80070006 " error message. So the problem is with $STDERR_CHILD + $STDOUT_CHILD optional flags. I'm going to try your code without it and see what happens. Link to comment Share on other sites More sharing options...
fcjoe Posted August 28, 2010 Author Share Posted August 28, 2010 Same result I guess I'm stuck with sending output to text file and reading the text file. This sucks Link to comment Share on other sites More sharing options...
wakillon Posted August 29, 2010 Share Posted August 29, 2010 (edited) Same result I guess I'm stuck with sending output to text file and reading the text file. This sucks I search parameters to http://technet.microsoft.com/en-us/library/cc780708(WS.10).aspx and when i try /help or /? I get this STDOUT read : BITSADMIN version 2.0 [ 6.6.2600.2180 ] BITS administration utility. (C) Copyright 2000-2004 Microsoft Corp. STDOUT read : Unable to get console input mode - 0x80070006 Descripteur non valide What's the error ? Edited August 29, 2010 by wakillon AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Link to comment Share on other sites More sharing options...
fcjoe Posted August 30, 2010 Author Share Posted August 30, 2010 I figured it out. I downloaded bitsadmin from Windows XP Support tools, which is an older version. I did some searching and found that there is a newer version in Windows Server 2003 Service Pack 2 32-bit Support ToolslinkThis newer version works with no problems.So the problem wasn't with my script, but with bitsadmin.exe itself.Thank you for all your help WakillonJoe Link to comment Share on other sites More sharing options...
wakillon Posted August 30, 2010 Share Posted August 30, 2010 (edited) I figured it out. I downloaded bitsadmin from Windows XP Support tools, which is an older version. I did some searching and found that there is a newer version in Windows Server 2003 Service Pack 2 32-bit Support ToolslinkThis newer version works with no problems.So the problem wasn't with my script, but with bitsadmin.exe itself.Thank you for all your help WakillonJoeThanks for the dowload link, I like work with command line tools ! See myGetCommandLineParameters Utility Edited August 30, 2010 by wakillon AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Link to comment Share on other sites More sharing options...
scdroid13 Posted May 30, 2019 Share Posted May 30, 2019 Does firewall has to do anything with this??? this 0x80070006 error is like killing me. searching since 2 hours for the solution. 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