Opened 5 years ago
Last modified 5 years ago
#3759 new Feature Request
Console (cmd.exe) output
Reported by: | moderncareca@… | Owned by: | |
---|---|---|---|
Milestone: | Component: | AutoIt | |
Version: | Severity: | None | |
Keywords: | Cc: |
Description
Hi, i'd like to see a feature, if at all possible, which is to be able to see the cmd window output when using $STDIN_CHILD + $STDOUT_CHILD flags.
Example of something that doesn't work this way:
#include <WinAPIConv.au3> #include <Constants.au3> Opt("MustDeclareVars", 1) Local $iPID = Run("cmd", '', @SW_SHOW, $STDIN_CHILD + $STDOUT_CHILD) ProcessWait($iPID) Sleep(2000) MsgBox(64 + 262144, '', StdoutRead($iPID)) ProcessClose($iPID) Exit
The expected result is to be able to read the output in the cmd window itself, instead of just being able to get the output with the StdoutRead function.
In the bellow example there is a similar code, but this time with conhost.exe instead of cmd.exe, and in this, im able to read the output in the window itself as well as obtain the read from the StdoutRead function. Even if the characters get a bit messed up.
#include <WinAPIConv.au3> #include <Constants.au3> Opt("MustDeclareVars", 1) Local $iPID = Run("conhost", '', @SW_SHOW, $STDIN_CHILD+ $STDOUT_CHILD) ProcessWait($iPID) Sleep(2000) MsgBox(64 + 262144, '', _WinAPI_OemToChar (StdoutRead($iPID))) StdinWrite($iPID, 'netstat -r'&@CRLF) Sleep(2000) MsgBox(64 + 262144, '', _WinAPI_OemToChar (StdoutRead($iPID))) ProcessClose($iPID) Exit
Attachments (0)
Guidelines for posting comments:
- You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
- In-depth discussions should take place on the forum.
For more information see the full version of the ticket guidelines here.
You can try this UDF:
https://github.com/MattDiesel/au3-console
or this:
https://www.autoitscript.com/forum/topic/112372-command-prompt-automation/