From afc1d8a4592241eac0d5194cae89c7ffb31df722 Mon Sep 17 00:00:00 2001 From: Andrew Schwartzmeyer Date: Wed, 6 Jul 2016 15:00:01 -0700 Subject: [PATCH] Use start in Get-Help -Online to open URL on Windows --- .../help/HelpCommands.cs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/System.Management.Automation/help/HelpCommands.cs b/src/System.Management.Automation/help/HelpCommands.cs index c9bc50ffd5..52a74fed07 100644 --- a/src/System.Management.Automation/help/HelpCommands.cs +++ b/src/System.Management.Automation/help/HelpCommands.cs @@ -699,17 +699,25 @@ namespace Microsoft.PowerShell.Commands { this.WriteVerbose(string.Format(CultureInfo.InvariantCulture, HelpDisplayStrings.OnlineHelpUri, uriToLaunch.OriginalString)); System.Diagnostics.Process browserProcess = new System.Diagnostics.Process(); + browserProcess.StartInfo.UseShellExecute = false; + if (Platform.IsWindows) { - browserProcess.StartInfo.FileName = uriToLaunch.OriginalString; - } else if (Platform.IsOSX) { + browserProcess.StartInfo.FileName = "cmd.exe"; + browserProcess.StartInfo.Arguments = string.Format(@"/c ""start /b """" {0}""", uriToLaunch.OriginalString); + } + else if (Platform.IsOSX) + { browserProcess.StartInfo.FileName = "open"; browserProcess.StartInfo.Arguments = uriToLaunch.OriginalString; - } else if (Platform.IsLinux) { + } + else if (Platform.IsLinux) + { browserProcess.StartInfo.FileName = "xdg-open"; browserProcess.StartInfo.Arguments = uriToLaunch.OriginalString; } + browserProcess.Start(); } catch (InvalidOperationException ioe)