开发者

runas command in windows 7

开发者 https://www.devze.com 2022-12-31 04:47 出处:网络
I\'m trying to run a batch file as admin. I found that I can use runas command which corresponds sudo command in Linux I think.

I'm trying to run a batch file as admin. I found that I can use runas command which corresponds sudo command in Linux I think.

I 开发者_运维技巧tried

runas /noprofile /user:computername\adminuser "blah.bat start"

But it gives an error, saying :

Logon failure: user account restriction.. (msdos window doesn't allow me to copy anything) is there any way I can run this batch file as admin? Right click doesn't work because I can't include any parameters.


A workaround: You can create a shortcut to the batch file, add a parameter in the shortcut, then right-click to run the shortcut as admin.


Right-click the icon for the command-prompt and choose Run As Administrator. Then run you batch file from that window.


I believe that you can allow or disallow the RunAs command with the registry.

HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\policies\Explorer
"HideRunAsVerb"= 1

See Disabling the RunAs Command

0

精彩评论

暂无评论...
验证码 换一张
取 消