123456789101112131415161718192021222324 |
- using System.Diagnostics;
- namespace NewArchivesCenter
- {
- internal class DeleteFolderWithAdminRights
- {
- public static void DeleteFolder(string folderPath)
- {
- string command = $"/c rmdir /s /q \"{folderPath}\"";
- ProcessStartInfo psi = new ProcessStartInfo
- {
- FileName = "cmd.exe",
- Arguments = command,
- Verb = "runas",
- UseShellExecute = true,
- WindowStyle = ProcessWindowStyle.Hidden
- };
- using (Process p = Process.Start(psi))
- {
- p.WaitForExit();
- }
- }
- }
- }
|