Skip to content
This repository has been archived by the owner on Aug 21, 2024. It is now read-only.

Commit

Permalink
修复 Service.SetStartTypeAsync(ServiceStartMode) 未隐藏调用程序窗口的 Bug
Browse files Browse the repository at this point in the history
  • Loading branch information
ricky8955555 committed Jan 23, 2021
1 parent c274636 commit 72c6407
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Models/Service.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public async Task StopAsync()
/// </summary>
public async Task SetStartTypeAsync(ServiceStartMode startType)
{
var processStartInfo = new ProcessStartInfo("sc.exe", $"config {Name} start= {_serviceStartModeDictionary[startType]}") { CreateNoWindow = false, WindowStyle = ProcessWindowStyle.Hidden };
var processStartInfo = new ProcessStartInfo("sc.exe", $"config {Name} start= {_serviceStartModeDictionary[startType]}") { CreateNoWindow = false, WindowStyle = ProcessWindowStyle.Hidden, UseShellExecute = true };
await Process.Start(processStartInfo).WaitForExitAsync();

Program.Logger.Add($"将 {Name} 服务的 StartType 调整为 {startType}");
Expand Down

0 comments on commit 72c6407

Please sign in to comment.