Docfxit Posted July 18, 2010 Share Posted July 18, 2010 (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 July 18, 2010 by docfxit Link to comment Share on other sites More sharing options...
Bowmore Posted July 18, 2010 Share Posted July 18, 2010 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 Link to comment Share on other sites More sharing options...
Docfxit Posted July 18, 2010 Author Share Posted July 18, 2010 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 Link to comment Share on other sites More sharing options...
Docfxit Posted July 18, 2010 Author Share Posted July 18, 2010 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 Link to comment Share on other sites More sharing options...
soadmania Posted July 18, 2010 Share Posted July 18, 2010 Start the CMD first and then send commands. It wont exit after finish its job. Link to comment Share on other sites More sharing options...
Docfxit Posted July 18, 2010 Author Share Posted July 18, 2010 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 Link to comment Share on other sites More sharing options...
soadmania Posted July 18, 2010 Share Posted July 18, 2010 Thanks for the reply...How can I do that?Thanks,DocfxitRun("cmd")Send("your commands")Send("{ENTER}")maybe? Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now