Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > VB Script

Vista - Determine if script was run from command prompt

Reply
 
Old 10-17-2008   #1 (permalink)
cwhankey


 
 

Determine if script was run from command prompt

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 System SpecsSystem Spec
Old 10-17-2008   #2 (permalink)
Tom Lavedas


 
 

Re: Determine if script was run from command prompt

On Oct 17, 10:43*am, cwhan...@xxxxxx wrote:
Quote:

> 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 System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
best way to determine if a command history exists? PowerShell
Wanting persistent variables from script at PS command prompt PowerShell
Solved Make a command prompt run a command as soon as it opens? General Discussion
My command works in the PS prompt but not in a script (.ps1) / reg PowerShell
Every time I run script from command prompt I get restricte cert e PowerShell


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46