Partager via


View::ExecuteShellCommand method

The ExecuteShellCommand method runs a command in a window. After this method successfully starts the command in a separate process, it returns immediately (it does not wait for the command to complete).

Syntax

View.ExecuteShellCommand( _
  ByVal Command As String, _
  ByVal Directory As String, _
  ByVal Parameters As String, _
  ByVal WindowState As String _
)

Parameters

Command

A value that specifies the command to execute. A fully qualified path may be specified. Any environment variables (such as "%windir%") contained in Command will be expanded.

Directory

A value that specifies the name of the working directory. Any environment variables contained in Directory will be expanded. If Directory is an empty string, the current directory is used as the working directory.

Parameters

A value that specifies parameters, if any, to be used by Command; the parameters must be separated by spaces. For example, specifying Parameters as "Param1 Param2" results in Command receiving Param1 and Param2 as parameters. If an individual parameter is required to be in double quotation marks, use the proper technique for your programming language. For example, in Microsoft Visual Basic, specifying Parameters as "Param1 ""This is Param2""" results in Command receiving Param1 and "This is Param2" as parameters.

WindowState

A value that specifies the state for the window. This value can be one of the following string values or an empty string. If it's an empty string, it defaults to "Restored".

"Maximized"

The command executes in a maximized window.

"Minimized"

The command executes in a minimized window.

"Restored"

The command executes in a restored, or normal, window.

Return value

This method does not return a value.

Requirements

Minimum supported client
Windows Vista
Minimum supported server
Windows Server 2008
Header
MMCObj.h
IDL
MMCObj.idl
DLL
Mmc.exe
IID
IID_View is defined as 6EFC2DA2-B38C-457E-9ABB-ED2D189B8C38