1. This needs to be done without writing the output to a file and then reading that file.
2. This needs to be done without writing using clipboard.
3. This needs to be done stealthily (in a meaning that no windows should appear while the script works out).
I've successfully managed to meet requirements 1. and 2., but don't know how to meet requirement 3.
Code: Select all
objShell := ComObjCreate("WScript.Shell")
; objShell.Visible := false ; Returns an error.
; objExec.Visible := false ; Doesn't affect anything.
objExec := objShell.Exec(ComSpec " /U /C ping google.com -n 1")
While, !objExec.StdOut.AtEndOfStream
result := objExec.StdOut.ReadAll()
MsgBox, % result
Another question is about codepage:
I'm using a localized windows OS and output sometimes contains non-latin chars. In that case msgbox shows them in the wrong charset (but in CMD I see non-latin chars normally). How to fix that?