退出bat脚本的cmd窗口
This commit is contained in:
9
Form1.cs
9
Form1.cs
@@ -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);
|
||||
|
Reference in New Issue
Block a user