From 54a6900769334d4cbe3c41a55ad7963f1c060167 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A4=A7=E7=9F=B3=E5=A4=B4?= Date: Mon, 25 Nov 2024 09:58:04 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=A4=E4=BA=92=E6=A8=A1=E5=BC=8F=E7=9B=B4?= =?UTF-8?q?=E6=8E=A5=E8=BF=90=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Stardust/Managers/ServiceController.cs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/Stardust/Managers/ServiceController.cs b/Stardust/Managers/ServiceController.cs index f2766aad..00ba08e9 100644 --- a/Stardust/Managers/ServiceController.cs +++ b/Stardust/Managers/ServiceController.cs @@ -399,9 +399,18 @@ public Boolean Start() // Windows桌面用户运行 if (Runtime.Windows && service.UserName == "$") { - var desktop = new Desktop { Log = Log }; - var pid = desktop.StartProcess(si.FileName, si.Arguments, si.WorkingDirectory); - p = Process.GetProcessById((Int32)pid); + // 交互模式直接运行 + if (Environment.UserInteractive) + { + p = Process.Start(si); + } + else + { + // 桌面用户运行 + var desktop = new Desktop { Log = Log }; + var pid = desktop.StartProcess(si.FileName, si.Arguments, si.WorkingDirectory); + p = Process.GetProcessById((Int32)pid); + } } else {