Jump to content

Show cmd window


Recommended Posts

How can I get the command window to stay open so the results of a run file will be displayed?

For example:

$ipconfig = Run (@ComSpec & " /c " & @SystemDir & "\ipconfig.exe /all", @SystemDir, @SW_SHOW)

If it's easier or also possible to display the results in a message or GUI window, that would server the purpose as well.

Thanks!!

Link to comment
Share on other sites

Wouldn't this work?:

$ipconfig = Run (@ComSpec & " /k " & @SystemDir & "\ipconfig.exe /all", @SystemDir, @SW_SHOW)
...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format
Link to comment
Share on other sites

Run (@ComSpec & " /c " & @SystemDir & "\ipconfig.exe /all")

Run (@ComSpec & " /k " & @SystemDir & "\ipconfig.exe /all")

forgot about that /k option... or make a pretty GUI

edit - jefhal beat me to it - I got side tracked during my reply

edit2 - sorry for the large triple post.

So that is what happens when you hit the button more than once. :-(

Edited by herewasplato

[size="1"][font="Arial"].[u].[/u][/font][/size]

Link to comment
Share on other sites

How can I get the command window to stay open so the results of a run file will be displayed?

Try this:

$ipconfig = Run (@ComSpec & " /c " & @SystemDir & "\ipconfig.exe /all & PAUSE", @SystemDir, @SW_SHOW)
Link to comment
Share on other sites

@blindwig,

"& PAUSE" - good one

I learn new things everyday...

...forget things everyday...

...but I'll soon forget that I forgot, so it is all okay.

edit: forgot how to spell

Edited by herewasplato

[size="1"][font="Arial"].[u].[/u][/font][/size]

Link to comment
Share on other sites

Herwasplato...

Could you please give me a pointer regarding creating the GUI that would host the cmd window? A keyword to do a help file search would suffice. I think I got the GUI create OK but not the display cmd...

CheersNobby

Link to comment
Share on other sites

@nobby,

I know nothing about GUIs. I was just commenting on what layer stated in post #3 of this thread. I would not even know what to tell you to search for.

See if layer responds to this with what you want..............

[size="1"][font="Arial"].[u].[/u][/font][/size]

Link to comment
Share on other sites

First, go download the beta from here: http://www.autoitscript.com/autoit3/files/beta/autoit/

Then, put constants.au3 in the same dir as THIS script:

#include <GUIConstants.au3>
#include "constants.au3"
$gui = GUICreate("console stuff")
$edit = GUICtrlCreateEdit("", 10, 10, 300, 300, BitOr($WS_VSCROLL, $WS_HSCROLL,$ES_READONLY))
GUISetState()
$ping = Run(@ComSpec & " /c ping google.com", @SystemDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)
While 1
    $lineout = StdoutRead($ping)
    If @Error = -1 Then ExitLoop
    GUICtrlSetData($edit, $lineout & @CRLF, 1)
WEnd

While 1
    $get = GUIGetMsg()
    If $get = -3 Then Exit
WEnd

Then run it with the BETA. :)

EDIT: But I'm too tired to figure out how to put the ipconfig in there... Going to bed now, soooo tired, but gotta get up EARLY tomorrow. :evil:

Edited by layer
FootbaG
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...