Re: (Correction) Keep the COMMAND Window open after script completes




"dch3" <dch3@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:021DA765-71D2-44B9-A6D0-87E6B2A7820D@xxxxxxxxxxxxxxxx
Correct - Keep the Command Prompt window open

"dch3" wrote:

Greetings from the hot & humid state of Florida...

I've started playing with WSH and need to figure out how to keep the WSH
window open once the script finishes executing. I'm running scripts via
CSCRIPT.EXE

If you are setting your default scripting engine to cscript.exe and then
starting the scripts by double-clicking them in windows explorer, I'm not
sure it can be done.

But if you are starting your script using the cscript command, whether from
a batch file or a shortcut, then try changing the command from something
like:

cscript //nologo myscript.vbs

to something like:

cmd /k cscript //nologo myscript.vbs

this will open a command prompt window to execute the above command. CMD.exe
will first run your script using cscript. When the script is finished, it
will return control to the cmd process, but the /K switch will keep the
window open with cmd running in interactive mode.

If you really need to run scripts by double-clicking in explorer, you might
want to try what I did. I used the ASSOC and FTYPE commands to define a new
file type, .CVB", with a command to "execute" this script by calling a batch
file that runs the script with cscript and then uses the pause command so
the output does not disappear. You could probably use a similar method to
have it keep the window open in a cmd shell by using the cmd command instead
of pause.

/Al


.



Relevant Pages