如何在C#中以管理員模式啟動(dòng)進(jìn)程我有一個(gè)VisualStudioWindows應(yīng)用程序項(xiàng)目。我添加了下載安裝程序更新文件的代碼。安裝程序完成下載后將需要管理員特權(quán)才能運(yùn)行。我添加了一個(gè)清單文件。當(dāng)用戶單擊DownloadUpdate.exe時(shí),UAC會(huì)提示用戶獲得管理權(quán)限。因此,我假設(shè)在DownloadUpdate.exe中創(chuàng)建和調(diào)用的所有進(jìn)程都將以管理能力運(yùn)行。因此,我使用以下代碼對(duì)已下載的文件進(jìn)行了安裝調(diào)用:Process p = new Process();p.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;p.StartInfo.FileName = strFile;p.StartInfo.UseShellExecute = false;p.StartInfo.RedirectStandardOutput = true;p.StartInfo.RedirectStandardError = true;
3 回答

溫溫醬
TA貢獻(xiàn)1752條經(jīng)驗(yàn) 獲得超4個(gè)贊
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
- 3 回答
- 0 關(guān)注
- 1102 瀏覽
添加回答
舉報(bào)
0/150
提交
取消