什么阻止我以管理员身份运行特定的应用程序?

什么阻止我以管理员身份运行特定的应用程序?

当我尝试使用需要使用此方法的程序来执行此操作时,它失败了:

runas /user:%computername%\administrator "c:\Program Files (x86)\CountMeIn\Monitor.exe"
Enter the password for PC1\administrator:
Attempting to start c:\Program Files (x86)\CountMeIn\Monitor.exe as user "PC1\administrator" ...
RUNAS ERROR: Unable to run - c:\Program Files (x86)\CountMeIn\Monitor.exe
740: The requested operation requires elevation.

尝试调试此过程,我使用不同的应用程序进行测试,并且运行正常。问题可能出在哪里?

runas /user:%computername%\administrator "c:\Program Files (x86)\VideoLAN\VLC\vlc.exe"
Enter the password for PC1\administrator:
Attempting to start c:\Program Files (x86)\VideoLAN\VLC\vlc.exe as user "PC1\administrator" ...

答案1

您需要以管理员身份提升命令提示符(以管理员身份运行)

使用 PowerShell 可以更轻松地提升

$username = "YourUsername"
$password = ConvertTo-SecureString -String "YourPassword" -AsPlainText -Force
$credentials = New-Object System.Management.Automation.PSCredential -ArgumentList $username, $password

Start-Process -FilePath "C:\Path\To\Your\Program.exe" -Credential $credentials -Verb RunAs

-Verb runAs 将提升它

相关内容