Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Keep the WSH Window open after script completes

515 views
Skip to first unread message

dch3

unread,
Aug 12, 2008, 4:35:01 PM8/12/08
to
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

dch3

unread,
Aug 12, 2008, 4:42:14 PM8/12/08
to
Correct - Keep the Command Prompt window open

Al Dunbar

unread,
Aug 12, 2008, 5:56:25 PM8/12/08
to

"dch3" <dc...@discussions.microsoft.com> wrote in message
news:021DA765-71D2-44B9...@microsoft.com...

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


0 new messages