diff --git a/src/System.Management.Automation/help/HelpCommands.cs b/src/System.Management.Automation/help/HelpCommands.cs index 52a74fed07..b6f69d498a 100644 --- a/src/System.Management.Automation/help/HelpCommands.cs +++ b/src/System.Management.Automation/help/HelpCommands.cs @@ -704,8 +704,20 @@ namespace Microsoft.PowerShell.Commands if (Platform.IsWindows) { + // this is a re-implementation of the unavailable (on .NET Core) UseShellExecute, + // where we manually execute a cmd.exe shell, and use its start command to + // launch the default application for the given path browserProcess.StartInfo.FileName = "cmd.exe"; - browserProcess.StartInfo.Arguments = string.Format(@"/c ""start /b """" {0}""", uriToLaunch.OriginalString); + + // start is very picky: the "optional" TITLE as the first argument should always + // be included, otherwise it can silently fail + browserProcess.StartInfo.Arguments = string.Format(CultureInfo.InvariantCulture, + @"/c ""start /b """" {0}""", uriToLaunch.OriginalString); + + // please note that there is currently no way to differentiate between running + // on Nano as an OS and having targeted the .NET Core framework, thus this code + // will continue to fail on Nano (as there is no browser), but at least is + // implemented for .NET Core PowerShell on Windows } else if (Platform.IsOSX) { diff --git a/src/System.Management.Automation/namespaces/FileSystemProvider.cs b/src/System.Management.Automation/namespaces/FileSystemProvider.cs index 7ee00beb27..2504bb3491 100644 --- a/src/System.Management.Automation/namespaces/FileSystemProvider.cs +++ b/src/System.Management.Automation/namespaces/FileSystemProvider.cs @@ -1337,9 +1337,20 @@ namespace Microsoft.PowerShell.Commands if (Platform.IsWindows) { + // this is a re-implementation of the unavailable (on .NET Core) UseShellExecute, + // where we manually execute a cmd.exe shell, and use its start command to + // launch the default application for the given path invokeProcess.StartInfo.FileName = "cmd.exe"; - // start is very picky: the "optional" TITLE as the first argument should always be included, otherwise it can silently fail - invokeProcess.StartInfo.Arguments = string.Format(@"/c ""start /b """" ""{0}""""", path); + + // start is very picky: the "optional" TITLE as the first argument should always + // be included, otherwise it can silently fail + invokeProcess.StartInfo.Arguments = string.Format(CultureInfo.InvariantCulture, + @"/c ""start /b """" ""{0}""""", path); + + // please note that there is currently no way to differentiate between running + // on Nano as an OS and having targeted the .NET Core framework, thus this code + // will continue to fail on Nano (as there is no browser), but at least is + // implemented for .NET Core PowerShell on Windows } else if (Platform.IsOSX) { invokeProcess.StartInfo.FileName = "open";