Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2649,10 +2649,14 @@ private ProcessInformation StartWithCreateProcess(ProcessStartInfo startinfo)
/// </summary>
private Process StartWithShellExecute(ProcessStartInfo startInfo)
{
Process result = null;
Process result = new() { StartInfo = startInfo };
try
{
result = Process.Start(startInfo);
if (!result.Start())
{
string msg = StringUtil.Format(ProcessResources.FailedToCreateProcessObject, startInfo.FileName);
WriteDebug(msg);
}
}
catch (Win32Exception ex)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,11 @@ Describe "Start-Process" -Tag "Feature","RequireAdminOnWindows" {
$process | Stop-Process
}

It "Should start ms-settings URI with ShellExecute" -Skip:(!$isFullWin) {
{ Start-Process ms-settings: -PassThru } | Should -Not -Throw
Get-Process "SystemSettings" | Stop-Process
}

It "Should be able to use the -WhatIf switch without performing the actual action" {
$pingOutput = Join-Path $TestDrive "pingOutput.txt"
{ Start-Process -Wait $pingCommand -ArgumentList $pingParam -RedirectStandardOutput $pingOutput -WhatIf -ErrorAction Stop @extraArgs} | Should -Not -Throw
Expand Down