WSManRunShellCommand function (wsman.h)
Starts the execution of a command within an existing shell and does not wait for the completion of the command.
Syntax
void WSManRunShellCommand(
[in, out] WSMAN_SHELL_HANDLE shell,
DWORD flags,
[in] PCWSTR commandLine,
[in, optional] WSMAN_COMMAND_ARG_SET *args,
[in, optional] WSMAN_OPTION_SET *options,
[in] WSMAN_SHELL_ASYNC *async,
[out] WSMAN_COMMAND_HANDLE *command
);
Parameters
[in, out] shell
Specifies the shell handle returned by the WSManCreateShell call. This parameter cannot be NULL.
flags
Reserved for future use. Must be zero.
[in] commandLine
Defines a required null-terminated string that represents the command to be executed. Typically, the command is specified without any arguments, which are specified separately. However, a user can specify the command line and all of the arguments by using this parameter. If arguments are specified for the commandLine parameter, the args parameter should be NULL.
[in, optional] args
A pointer to a WSMAN_COMMAND_ARG_SET structure that defines an array of argument values, which are passed to the command on creation. If no arguments are required, this parameter should be NULL.
[in, optional] options
Defines a set of options for the command. These options are passed to the service to modify or refine the command execution. This parameter can be NULL. For more information about the options, see WSMAN_OPTION_SET.
[in] async
Defines an asynchronous structure. The asynchronous structure contains an optional user context and a mandatory callback function. See the WSMAN_SHELL_ASYNC structure for more information. This parameter cannot be NULL and should be closed by calling the WSManCloseCommand method.
[out] command
Defines the command object associated with a command within a shell. This handle is returned on a successful call and is used to send and receive data and to signal the command. This handle should be closed by calling the WSManCloseCommand method. This parameter cannot be NULL.
Return value
None
Requirements
Requirement | Value |
---|---|
Minimum supported client | Windows 7 |
Minimum supported server | Windows Server 2008 R2 |
Target Platform | Windows |
Header | wsman.h |
Library | WsmSvc.lib |
DLL | WsmSvc.dll |
Redistributable | Windows Management Framework on Windows Server 2008 with SP2 and Windows Vista with SP2 |