我正在製作技術含量的工具程序,包括在這個「工具箱」將運行在本地磁盤碎片整理按鈕磁盤。目前我已經爲這個做批處理文件很簡單,它只是運行一個基本的碎片分析:的Windows碎片整理不被識別爲一個內部或外部命令,可操作的程序或批處理文件
defrag C: /A
按鈕背後的C#代碼觸發是這樣的:
System.Diagnostics.ProcessStartInfo procInfo =
new System.Diagnostics.ProcessStartInfo();
procInfo.Verb = "runas";
procInfo.FileName = "(My Disk):\\PreDefrag.bat";
System.Diagnostics.Process.Start(procInfo);
此代碼不正是我想要的是,它調用UAC然後啓動我的批處理文件與管理權限。儘管曾是該批處理文件運行,我收到的命令控制檯輸出爲:
C:\Windows\system32>defrag C: /A
'defrag' is not recognized as an internal or external command,
operable program or batch file.
是什麼原因導致這個錯誤,我該如何解決?
請發佈您的PreDefrag.bat文件的內容。你在使用什麼操作系統? Windows 7的? Windows Vista? Windows家庭高級版? Windows XP? Windows 2000? –