Docfxit 7 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 Share this post Link to post Share on other sites
Bowmore 97 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 Share this post Link to post Share on other sites
Docfxit 7 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 Share this post Link to post Share on other sites
Docfxit 7 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 Share this post Link to post Share on other sites
soadmania 0 Posted July 18, 2010 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
Docfxit 7 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 Share this post Link to post Share on other sites
soadmania 0 Posted July 18, 2010 Thanks for the reply...How can I do that?Thanks,DocfxitRun("cmd")Send("your commands")Send("{ENTER}")maybe? Share this post Link to post Share on other sites