-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Description
The topic currently states:
When using PowerShell Core on Linux, to open a new process within a new window (similar to the default behavior when using Start-Process in Windows), run the cmdlet with the
UseNewEnvironmentandWaitparameters. This prevents the new process from blocking PowerShell's control of keyboard input.
The -UseNewEnvironment switch is unrelated to -Wait and should only be used if you do not want to inherit the calling process' environment block. -Wait by itself is enough to prevent the problem of competing for keyboard input.
In fact, -UseNewEnvironment is problematic on Unix and virtually useless in its current form - see PowerShell/PowerShell#4671.
On a related note:
On Windows, when you use
UseNewEnvironment, the new process starts only containing the default environment variables defined for the Machine and User scopes. This change was made in PowerShell 7.1.
It's better to call this a bug fix, because that's what it was.
In order words: on Windows, -UseEnvironment didn't work properly up to and including version 7.0 - crucial user-level and dynamic environment variables were missing from the new process' environment, as described in PowerShell/PowerShell#4671
Also:
-
The paragraph describing
-UseNewEnvironmentis Windows-centric and doesn't cover the Unix behavior described in Start-Process -UseNewEnvironment provides an environment that is missing crucial standard environment variables while not supporting passing a new environment PowerShell/PowerShell#4671. -
The up-to-v7.0 Windows bug is worth mentioning in the topics for the affected versions.
Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
- ID: fa4b8de4-3ea1-4210-4562-b084b0a51c0d
- Version Independent ID: ab184c39-041b-588c-acde-f715f6d3aee2
- Content: Start-Process (Microsoft.PowerShell.Management)
- Content Source: reference/7.0/Microsoft.PowerShell.Management/Start-Process.md
- Product: powershell
- GitHub Login: @daxian-dbw
- Microsoft Alias: dongbow