WslLaunchInteractive function (wslapi.h)

Launches an interactive Windows Subsystem for Linux (WSL) process in the context of a particular distribution.This differs from WslLaunch in that the end user will be able to interact with the newly-created process.


HRESULT WslLaunchInteractive(
  [in]           PCWSTR distributionName,
  [in, optional] PCWSTR command,
  [in]           BOOL   useCurrentWorkingDirectory,
  [out]          DWORD  *exitCode


[in] distributionName

Unique name representing a distribution (for example, "Fabrikam.Distro.10.01").

[in, optional] command

Command to execute. If no command is supplied, launches the default shell.

[in] useCurrentWorkingDirectory

Governs whether or not the launched process should inherit the calling process's working directory. If FALSE, the process is started in the WSL default user's home directory ("~").

[out] exitCode

Receives the exit code of the process after it exits.

Return value

Returns S_OK on success, or a failing HRESULT otherwise.


Target Platform Windows
Header wslapi.h
Library Wslapi.lib
DLL Api-ms-win-wsl-api-l1-1-0.dll