

The lpValue parameter is a pointer to a handle to a process to use instead of the calling process as the parent for the process being created. } SHELLEXECUTEINFOW, *LPSHELLEXECUTEINFOW (ShellExecuteEx SEE_MASK_NO_CONSOLE not work) This is a problem that needs to be solved to enable sudo support to run in Windows Terminal. The high-privilege process (AppInfo service) creates an Administrator process and sets its parent process as a normal process.ĪppInfo does not currently support setting up a working directory, input and output (although calling CreateProcessAsUser) when launching the administrator process. In fact, runas is actually a normal process that initiates an RPC request to a high-privileged process. Results are gathered, and handles are cleaned up.DeleteProcThreadAttributeList() is called.CreateProcessAsUser() is called with EXTENDED_STARTUPINFO_PRESENT and the results of steps 1 and 4.UpdateProcThreadAttribute() is called with PROC_THREAD_ATTRIBUTE_PARENT_PROCESS, and uses the handle retrieved in step 3.


In fact, what Windows lacks is the kind of privilege implementation that does not require UI interaction, like sudo.īut implementing sudo can also be cumbersome. As far as I know, Windows Terminal does not implement any code from the Administrator to the restricted user. You can always use an account without the username of Administrator if it has administrator access rights/permissions.Windows Terminal support running in admin mode may not be a good behavior, which means that all shells in other tabs opened from Ctrl+T may be administrator privilege. Also it's quite possible that you have never set the password on the Administrator account, as it will ask you for the password when trying to run the command.Just don't forget to put double quotes around anything that has a space in it.If for some weird reason this is not running your commands as an Administrator you can try the runas command. The electron framework likes to stall processes when closing them so it's best to check your task manager and kill the remaining processes. Make sure you have all other instances of VS Code closed and then try to run as Administrator. Check "Run this program as an administrator".Running Visual Studio Code as Administrator should do the trick.
