Saturday, February 11, 2017

VBScript Lunch Program Using Shell Execute

VBScript is a scripting language to manage computer developed by Microsoft. Below is a code snippet to open an external program using Shell Application.

Dim objShell

Program_Name = "Notepad.exe"
Arguments = "" 'Optional
Directory = "" 'Optional
Operation = "open" 'open,edit,find,print,properties
Show_Option = 1 

Set objShell = CreateObject("Shell.Application")
objShell.ShellExecute Program_Name, Arguments, Directory, Operation, Show_Option

Set objShell = Nothing

'0 = Open the application with a hidden window.
'1 = Open the application with a normal window. If the window is minimized or maximized, the system restores it to its original size and position.
'2 = Open the application with a minimized window.
'3 = Open the application with a maximized window.
'4 = Open the application with its window at its most recent size and position. The active window remains active.
'5 = Open the application with its window at its current size and position.
'7 = Open the application with a minimized window. The active window remains active.
'10 = Open the application with its window in the default state specified by the application.

No comments:

Post a Comment