The wscript.Shell + Shell.Application objects

Provides access to OS Shell methods.

Syntax 
      Set objShell = CreateObject("Wscript.Shell") 

Methods
   .AppActivate      'Activate running command.
   .Run              'Run an application.
   .TileVertically   'Tile app windows.
   .RegRead          'Read from registry.
   .RegDelete        'Delete from registry.
   .RegWrite         'Write to the registry.

Syntax 
      Set objShell = CreateObject("Shell.Application")

Methods
   .BrowseForFolder 	'Display a dialog box to select a folder.
   .CanStartStopService("ServiceName")   'Can the current user start/stop the named service?
   .CascadeWindows      'Arrange app windows.
   .EjectPC             'Eject PC from a docking station.
   .ExpandEnvironmentStrings 'Expand a Windows environment variable.
   .Explore(FolderPath) 'Open a folder.
   .FileRun             'Open the File-run dialogue.
   .GetSystemInformation("PhysicalMemoryInstalled")  'Physical memory installed, in bytes.
   .IsServiceRunning("ServiceName")  'Check if a Windows service is running.
   .MinimizeAll         'Minimize everything.
   .NameSpace("C:\\")   'Create an object reference to a folder.
   .ServiceStart("ServiceName", true)  'Start a windows service.
   .ServiceStop("ServiceName", true)   'Stop a windows service.
   .SetTime             'Open the set time GUI.
   .ShellExecute        'Run a script or application.
   .ShutdownWindows
   .TileHorizontally    'Tile app windows.
   .TileVertically      'Tile app windows.
   .ToggleDesktop       'Show/Hide Desktop.
   .TrayProperties      'Display the Taskbar/Start Menu Properties.
   .UndoMinimizeAll     'Un-Minimize everything.
    Some additional methods can be found here.

Examples

Dim objShell
Set objShell = WScript.CreateObject("WScript.Shell")
objShell.Run "C:\Demo"
Set objShell = Nothing

“It is possible to store the mind with a million facts and still be entirely uneducated” ~ Alec Bourne

Related VBScript commands

.AppActivate - Activate running command.
.Application - BrowseForFolder/Open.
.Run a command.


 
Copyright © 1999-2023 SS64.com
Some rights reserved