Sign in to follow this  
Followers 0
Docfxit

How to make a DOS window stay open

7 posts in this topic

#1 ·  Posted (edited)

How can I get a bat file window to stay open so I can see if there are any errors?

$Var1 = "C:\Dnload\9xAddons\Ultimate Windows Tweaker v 2.1.zip"
Local $sUserName = "Administrator"
Local $sPassword = ""

$Return = RunAsWait($sUserName, @ComputerName, $sPassword, 0,@Comspec & ' /c C:\Dnload\9xAddons\UnZip.bat "' & $Var1 & '"', @SW_MAXIMIZE)

Bat file:

@Echo Off
"C:\Dnload\9xAddons\Batch\7za.exe" e -ao %1 *  

Ping 127.0.0.1 -n 10 > NUL
Pause
CMD

Thank you,

Docfxit

Edited by docfxit

Share this post


Link to post
Share on other sites



How can I get a bat file window to stay open so I can see if there are any errors?

$Return = RunAsWait($sUserName, @ComputerName, $sPassword, 0,@Comspec & ' /c C:\Dnload\9xAddons\UnZip.bat "' & $Var1 & '" & "' & $Win7 & '"', @SW_MAXIMIZE)

Change the /c switch to /k

$Return = RunAsWait($sUserName, @ComputerName, $sPassword, 0,@Comspec & ' /k C:\Dnload\9xAddons\UnZip.bat "' & $Var1 & '" & "' & $Win7 & '"', @SW_MAXIMIZE)

"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning."- Rick Cook

Share this post


Link to post
Share on other sites

Thanks for the reply...

Change the /c switch to /k

$Return = RunAsWait($sUserName, @ComputerName, $sPassword, 0,@Comspec & ' /k C:\Dnload\9xAddons\UnZip.bat "' & $Var1 & '" & "' & $Win7 & '"', @SW_MAXIMIZE)

I tried that. The window still doesn't stay open.

Thanks,

Docfxit

Share this post


Link to post
Share on other sites

The cmd window will stay open with this and I get the msg "File UnZipped Correctly"

$Var1 = "C:\Dnload\9xAddons\Ultimate Windows Tweaker v 2.1.zip"
$Return = RunWait(@Comspec & ' /K C:\Dnload\9xAddons\UnZip.bat "' & $Var1 & '"')
If @error Then
    MsgBox(0, "Error unzipping file", "Error code: " & @error & @CRLF & $Var1 & @CRLF & "Return value = " & $Return)
Else
    MsgBox(0, "File UnZipped", "File UnZipped Correctly")
EndIf

The cmd window Not will stay open with this and I get the error msg.

$Var1 = "C:\Dnload\9xAddons\Ultimate Windows Tweaker v 2.1.zip"
Local $sUserName = "Administrator"
Local $sPassword = ""
$Return = RunAsWait($sUserName, @ComputerName, $sPassword, 0,@Comspec & ' /K C:\Dnload\9xAddons\UnZip.bat "' & $Var1 & '"')
If @error Then
    MsgBox(0, "Error unzipping file", "Error code: " & @error & @CRLF & $Var1 & @CRLF & "Return value = " & $Return)
Else
    MsgBox(0, "File UnZipped", "File UnZipped Correctly")
EndIf

Any ideas what I am doing wrong?

Thanks,

Docfxit

Share this post


Link to post
Share on other sites

Start the CMD first and then send commands. It wont exit after finish its job.

Share this post


Link to post
Share on other sites

Thanks for the reply...

Start the CMD first and then send commands. It wont exit after finish its job.

How can I do that?

Thanks,

Docfxit

Share this post


Link to post
Share on other sites

Thanks for the reply...

How can I do that?

Thanks,

Docfxit

Run("cmd")

Send("your commands")

Send("{ENTER}")

maybe?

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