所以,说我有
string path = "C:\\Program Files\\Program\\File.exe";
我如何只获得“File.exe”?我在想一些分裂的东西(见下文),但我试过的东西不起作用......
这是我的代码。
List<string> procs = new List<string>(); //Used to check if designated process is already running
foreach (Process prcs in Process.GetProcesses())
procs.Add(prcs.ProcessName); //Add each process to the list
foreach (string l in File.ReadAllLines("MultiStart.txt")) //Get list of processes (full path)
if (!l.StartsWith("//")) //Check if it's commented out
if (!procs.Contains(l.Split('\\')[l.Split('\\').Length - 1])) //Check if process is already running
Process.Start(l);
我可能只是一个菜鸟。._.