windows尝试写了一个打开应用程序的exe

using System;
using System.Diagnostics;

namespace HelloWorld
{
class Program
{
static void Main(string[] args)
{
try
{
// 要打开的软件的路径
string softwarePath_idea = "";
string softwarePath_vscode = "";
string softwarePath_vm = "";
string softwarePath_db = ""

// 启动进程并获取对应的 Process 对象
Process process = Process.Start(softwarePath_idea);
process = Process.Start(softwarePath_vscode);
process = Process.Start(softwarePath_vm);
process = Process.Start(softwarePath_db);

// 在这里可以执行其他的操作...

// 等待进程结束
process.WaitForExit();
process.Kill();
}
catch (Exception ex)
{
Console.WriteLine("打开软件时出现错误: " + ex.Message);
}
}
}
}

 

由于不知道怎么杀掉当前进程,所以可能要手动删掉下

posted on 2023-07-07 23:48  QAAAQ  阅读(11)  评论(0编辑  收藏  举报

导航