退出bat脚本的cmd窗口

This commit is contained in:
2025-06-26 22:48:33 +08:00
parent 4d725c37d1
commit 1563478854

View File

@@ -197,9 +197,9 @@ namespace CheckDownload
// 无需更新时清理临时文件夹
CleanupTempDirectory();
// 显示更新完成并等待3
// 显示更新完成并等待2
UpdateStatus("更新完成");
await Task.Delay(3000);
await Task.Delay(2000);
this.Close();
return;
}
@@ -913,15 +913,16 @@ namespace CheckDownload
}
batchContent.AppendLine("del \"%~f0\" /f /q");
batchContent.AppendLine("exit");
File.WriteAllText(batchFilePath, batchContent.ToString(), new UTF8Encoding(false));
var startInfo = new ProcessStartInfo
{
FileName = "cmd.exe",
Arguments = $"/c start \"\" /min \"{batchFilePath}\"",
Arguments = $"/c \"{batchFilePath}\"",
CreateNoWindow = true,
UseShellExecute = true,
UseShellExecute = false,
WindowStyle = ProcessWindowStyle.Hidden
};
Process.Start(startInfo);