• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Determine if script was run from command prompt

C

cwhankey

#1
How can I determine in my VBScipt whether the script was run from the
command prompt or from double clicking in Windows Explorer? I want to
pause the script at the end if it was run from the command prompt but
Wscript.StdIn.ReadLine errors if it the script is not run as with the
console.
 

My Computer

T

Tom Lavedas

#2
On Oct 17, 10:43 am, cwhan...@xxxxxx wrote:

> How can I determine in my VBScipt whether the script was run from the
> command prompt or from double clicking in Windows Explorer?  I want to
> pause the script at the end if it was run from the command prompt but
> Wscript.StdIn.ReadLine errors if it the script is not run as with the
> console.
The WSH.Name property returns the name of the host executable that was
invoked to run the script. In general, WScript.exe is the GUI host
and cscript.exe is the console host. These names could be changed,
but 99.44% of the time this should be accurate.

Tom Lavedas
-------------------
 

My Computer

Users Who Are Viewing This Thread (Users: 1, Guests: 0)