WSManSignalShell function (wsman.h)

Sends a control code to an existing command or to the shell itself.

Syntax

void WSManSignalShell(
  [in]           WSMAN_SHELL_HANDLE     shell,
  [in, optional] WSMAN_COMMAND_HANDLE   command,
                 DWORD                  flags,
  [in]           PCWSTR                 code,
  [in]           WSMAN_SHELL_ASYNC      *async,
  [out]          WSMAN_OPERATION_HANDLE *signalOperation
);

Parameters

[in] shell

Specifies the handle returned by a WSManCreateShell call. This parameter cannot be NULL.

[in, optional] command

Specifies the command handle returned by a WSManRunShellCommand call. If this value is NULL, the signal code is sent to the shell.

flags

Reserved for future use. Must be set to zero.

[in] code

Specifies the signal code to send to the command or shell. The following codes are common.

WSMAN_SIGNAL_SHELL_CODE_TERMINATE

The shell or Command Prompt window was closed.

WSMAN_SIGNAL_SHELL_CODE_CTRL_C

The signal for CTRL+C was received, and the process was halted.

WSMAN_SIGNAL_SHELL_CODE_CTRL_BREAK

The signal for CTRL+BREAK was received, and the process was halted.

[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 WSManCloseOperation method.

[out] signalOperation

Defines the operation handle for the signal operation. This handle is returned from a successful call of the function and can be used to asynchronously cancel the signal operation. This handle should be closed by calling the WSManCloseOperation 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, Windows Vista with SP1, and Windows Vista with SP2