Vì vậy, nói tôi cóC# - Làm thế nào để trích xuất tên tập tin và phần mở rộng từ một đường dẫn?
string path = "C:\\Program Files\\Program\\File.exe";
Làm thế nào để tôi nhận được chỉ "file.exe"? Tôi đã suy nghĩ một cái gì đó với phân chia (xem bên dưới), nhưng những gì tôi đã cố gắng không hoạt động ...
Đây là mã của tôi.
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);
Tôi có thể chỉ là một noob. ._.
Mã của tôi cần Path.GetFileNameWithoutExtension, nhưng cảm ơn ... – CrimsonDeath
Đó không phải là những gì yo câu hỏi ur nói, mặc dù. – Joey