Windows Vista Forums

Determine if script was run from command prompt

  1. #1


    cwhankey Guest

    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

  2. #2


    Tom Lavedas Guest

    Re: Determine if script was run from command prompt

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


Determine if script was run from command prompt
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