簡體   English   中英

在節點 js 中使用管理員權限運行 exe

[英]Run exe with admin perms in node js

我想以管理員身份使用節點啟動一個 exe 文件。 嘗試過這樣的事情,但這不想工作:

exec('runas /user:Administrator "app.exe"', function(err, data) {  
                        console.log(err)                       
});

我總是收到此錯誤: Error: Command failed: runas /user:Administrator "app.exe"

有任何想法嗎?

根據runas文檔,您應該像這樣包含 ComputerName:

If you want to use the Administrator account on your computer, for the /user: parameter, type one of the following:

**/user:<**AdministratorAccountName>@<ComputerName>

**/user:<ComputerName>\<**AdministratorAccountName>    <----- here

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM