| Author |
Message |
D-a-n_L
Guest
|
Posted:
Thu Dec 23, 2004 9:43 pm Post subject:
Keep Script CLI window open |
|
|
Is there a way to keep the VBScript CLI window open if you execute the
script from the GUI? As you know when you execute the script from the CLI it
processes and then displays the results however when you execute the script
by double clicking it in the GUI it runs then closes, can you keep the
window open? I still want to remain in cscript not wscript... |
|
| Back to top |
|
 |
McKirahan
Guest
|
Posted:
Thu Dec 23, 2004 10:06 pm Post subject:
Re: Keep Script CLI window open |
|
|
"D-a-n_L" <djlajoie@hotmail.com> wrote in message
news:ObRbpYQ6EHA.2196@TK2MSFTNGP14.phx.gbl...
| Quote: | Is there a way to keep the VBScript CLI window open if you execute the
script from the GUI? As you know when you execute the script from the CLI
it
processes and then displays the results however when you execute the
script
by double clicking it in the GUI it runs then closes, can you keep the
window open? I still want to remain in cscript not wscript...
I gather that CLI is "Command Line Interface". |
The "window" that you want to keep opened is the command prompt not the
script's.
How are results displayed -- via MsgBox, WScript,Echo or ?
Perhaps you want an HTA (HTML Application); which is (VB)Script with an
interface. |
|
| Back to top |
|
 |
D-a-n_L
Guest
|
Posted:
Thu Dec 23, 2004 10:14 pm Post subject:
Re: Keep Script CLI window open |
|
|
I understand that it is the command prompt not the scripts window. I am
outputting the results via wscript.echo and want the command prompt to stay
open if the vbscript is executed from the gui.
"McKirahan" <News@McKirahan.com> wrote in message
news:n2Cyd.245245$V41.45190@attbi_s52...
| Quote: | "D-a-n_L" <djlajoie@hotmail.com> wrote in message
news:ObRbpYQ6EHA.2196@TK2MSFTNGP14.phx.gbl...
Is there a way to keep the VBScript CLI window open if you execute the
script from the GUI? As you know when you execute the script from the CLI
it
processes and then displays the results however when you execute the
script
by double clicking it in the GUI it runs then closes, can you keep the
window open? I still want to remain in cscript not wscript...
I gather that CLI is "Command Line Interface".
The "window" that you want to keep opened is the command prompt not the
script's.
How are results displayed -- via MsgBox, WScript,Echo or ?
Perhaps you want an HTA (HTML Application); which is (VB)Script with an
interface.
|
|
|
| Back to top |
|
 |
Michael Harris (MVP)
Guest
|
Posted:
Fri Dec 24, 2004 1:21 am Post subject:
Re: Keep Script CLI window open |
|
|
D-a-n_L wrote:
| Quote: | I understand that it is the command prompt not the scripts window. I
am outputting the results via wscript.echo and want the command
prompt to stay open if the vbscript is executed from the gui.
|
add this to the end of the script...
wscript.stdin.readline
This waits for the user to enter something into the console window, at a
minimum the pressing of the ENTER key. What the user enters is not
important and is simply ignored unless you assign what was read to a
variable.
Note that this line will throw an error if the script is executed under
wscript.exe rather than the console mode host cscript.exe.
--
Michael Harris
Microsoft MVP Scripting |
|
| Back to top |
|
 |
Herb Martin
Guest
|
Posted:
Fri Dec 24, 2004 1:46 am Post subject:
Re: Keep Script CLI window open |
|
|
"Michael Harris (MVP)" <mikhar at mvps dot org> wrote in message
news:#xI#fSS6EHA.2552@TK2MSFTNGP09.phx.gbl...
| Quote: | D-a-n_L wrote:
I understand that it is the command prompt not the scripts window. I
am outputting the results via wscript.echo and want the command
prompt to stay open if the vbscript is executed from the gui.
add this to the end of the script...
wscript.stdin.readline
|
Michael has the right idea -- just make sure the program
doesn't REALLY terminate until the user presses a key
or something.
You could also display a message box or something but
Michael's suggestion is probably more convenient and
elegant.
| Quote: | This waits for the user to enter something into the console window, at a
minimum the pressing of the ENTER key. What the user enters is not
important and is simply ignored unless you assign what was read to a
variable.
Note that this line will throw an error if the script is executed under
wscript.exe rather than the console mode host cscript.exe. |
|
|
| Back to top |
|
 |
Al Dunbar [MS-MVP]
Guest
|
Posted:
Fri Dec 24, 2004 9:44 am Post subject:
Re: Keep Script CLI window open |
|
|
"Herb Martin" <news@LearnQuick.com> wrote in message
news:etkoQjS6EHA.4040@TK2MSFTNGP14.phx.gbl...
| Quote: | "Michael Harris (MVP)" <mikhar at mvps dot org> wrote in message
news:#xI#fSS6EHA.2552@TK2MSFTNGP09.phx.gbl...
D-a-n_L wrote:
I understand that it is the command prompt not the scripts window. I
am outputting the results via wscript.echo and want the command
prompt to stay open if the vbscript is executed from the gui.
add this to the end of the script...
wscript.stdin.readline
Michael has the right idea -- just make sure the program
doesn't REALLY terminate until the user presses a key
or something.
You could also display a message box or something but
Michael's suggestion is probably more convenient and
elegant.
|
Another way that *might* be more convenient in some cases would be to
double-click on a batch file that runs the script rather than on the script
itself, i.e.:
@echo off
cscript.exe //nologo "~dpn0.vbs"
pause
Alternately, you could drag-and-drop your scripts onto a single batch file
that looked like this:
@echo off
cscript.exe //nologo %1
pause
Doing it this way has the added advantage of allowing you yo leave
wscript.exe as the default scripting engine. Don't forget that, in the same
way that some scripts (yours) are designed to work with cscript.exe, some
have a built-in expectation that they will run under wscript.exe. Unless, of
course, you NEVER run anybody else's scripts... ;-)
/Al
| Quote: | This waits for the user to enter something into the console window, at a
minimum the pressing of the ENTER key. What the user enters is not
important and is simply ignored unless you assign what was read to a
variable.
Note that this line will throw an error if the script is executed under
wscript.exe rather than the console mode host cscript.exe.
|
|
|
| Back to top |
|
 |
|
|
|
|