Is there a way to start a program minimized with VBScript using WScript.Shell?

20,573

Check the docs and use the second parameter of the .Run method.

Evidence:

set s = createobject("WScript.Shell")
s.run "notepad", 2

starts Notepad minimized.

Share:
20,573
Ethan Allen
Author by

Ethan Allen

Always learning.

Updated on July 08, 2020

Comments

  • Ethan Allen
    Ethan Allen almost 4 years

    Here is some example code I have right now to launch an app:

    Set objShell = Wscript.CreateObject("WScript.Shell")     
    objShell.Run """C:\Program Files\Handbrake\HandBrakeCLI.exe"""
    

    I tried the following to launch the app minimized but it didn't work. I'm assuming this only works from a normal command prompt?

    Set objShell = Wscript.CreateObject("WScript.Shell")     
    objShell.Run "start /MIN ""C:\Program Files\Handbrake\HandBrakeCLI.exe"""
    

    I've also tried launching a shortcut (which just gave a null error and the script couldn't run) as well as trying to do a sendkeys to minimize it which didn't work at all.

    This is from a VBScript running via cscript.exe by the way.

    Does anyone know how I can start this app minimized within VBScript?