mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-16 11:48:06 +01:00
[PTRun][Service]Fix service name with spaces (#17708)
This commit is contained in:
committed by
GitHub
parent
52709ddc4a
commit
a5323b75d9
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
@@ -81,16 +81,16 @@ namespace Microsoft.PowerToys.Run.Plugin.Service.Helpers
|
||||
|
||||
if (action == Action.Start)
|
||||
{
|
||||
info.Arguments = string.Join(' ', "start", serviceResult.ServiceName);
|
||||
info.Arguments = $"start \"{serviceResult.ServiceName}\"";
|
||||
}
|
||||
else if (action == Action.Stop)
|
||||
{
|
||||
info.Arguments = string.Join(' ', "stop", serviceResult.ServiceName);
|
||||
info.Arguments = $"stop \"{serviceResult.ServiceName}\"";
|
||||
}
|
||||
else if (action == Action.Restart)
|
||||
{
|
||||
info.FileName = "cmd";
|
||||
info.Arguments = string.Join(' ', "/c net stop", serviceResult.ServiceName, "&&", "net start", serviceResult.ServiceName);
|
||||
info.Arguments = $"/c net stop \"{serviceResult.ServiceName}\" && net start \"{serviceResult.ServiceName}\"";
|
||||
}
|
||||
|
||||
var process = Process.Start(info);
|
||||
|
||||
Reference in New Issue
Block a user