Sign in to follow this  
Followers 0
stev379

Show cmd window

12 posts in this topic

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!!

Share this post


Link to post
Share on other sites



...probably an "AutoIt way"... but I would just make a *.bat file with:

ipconfig /all

pause

and use RunWait to call the bat file..............


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

Share this post


Link to post
Share on other sites

You can display the results with the latest BETA inside of a GUI... Check it out, it's very useful.


FootbaG

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Wouldn't this work?:

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

<{POST_SNAPBACK}>

Bada Bing! :)

That does it. Thanks!!

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

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]

Share this post


Link to post
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)

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

@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]

Share this post


Link to post
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

Share this post


Link to post
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]

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites

Thanks,

That's exactly what I needed...


CheersNobby

Share this post


Link to post
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
Sign in to follow this  
Followers 0