Jump to content

how can i read dos window text w/o losing the window.


iahngy
 Share

Recommended Posts

I need the window dos  from @comspec to show all times so I can read the output status on it.

so I cant use Run(@ComSpec & " /c " & 'commandName', "", @SW_show)  because it always

disappear after the commands.

so I try the code below, but I cant get the stdoutread  ...if I set for run other option to read dos , it will read but the dos disappear ...wonder if you can give any way to read dos w/o losing the dos window.

 

 

run(@Comspec,"", @SW_SHOW, $RUN_CREATE_NEW_CONSOLE)

 WinWaitActive("cmd.exe")
    ControlSend ("cmd.exe", "", "", "test.bat {enter}")
winwaitactive("anotherwindow")

Local $sOutput = StdoutRead($iPID)
Link to comment
Share on other sites

  • Moderators

From the help file under @ComSpec

Run(@comspec & " /k help | more")
Edited by JLogan3o13

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

 

From the help file under @ComSpec

Run(@comspec & " /k help | more")

I believe this help file example does not work on :-

Running:(3.3.10.2);

Environment(Language:0409  Keyboard:00000409  OS:WIN_7/Service Pack 1  CPU:X64 OS:X64).

 

run(@Comspec & " /c","", @SW_SHOW, $RUN_CREATE_NEW_CONSOLE)

Maybe.

Magic variables don't work.

 

I found this example works for me.  Plus, it  shows the meaning of the "/c" and "/k" command options.

ConsoleWrite(@ComSpec & @LF) ; FYI

;Run(@ComSpec & " /k " & @ComSpec & " /?")

; Or

RunWait(@ComSpec & " /k " & @ComSpec & " /?")
Link to comment
Share on other sites

  • Moderators

@Malkey Did you try the example? It works for me as written on 3.3.10.0 through 3.3.11.3 Beta, on WIN7 32 and 64 bit as well as 8.1. I would not suggest it if I hadn't tested it out ;)

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

  • Moderators

iahngy, you asked how to keep your command window visible. The point I was making is, instead of /c you want /k

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

when you redirect Std_I/O of the cmd, the input and output streams will no more displayed on the cmd screen but redirected to the "redirected" streams instead.
if you want to view what's going on, you have to simulate a cmd screen and send the streams to it.
>here an example from MHz (you should remove "MsgBox(0, 'tail', $tail)" near the end of the listing)

 

image.jpeg.9f1a974c98e9f77d824b358729b089b0.jpeg Chimp

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...