how to run program as administrator in cmd
2016-01-27 00:00
519 查看
As stated here http://msdn.microsoft.com/en-us/library/bb756922.aspx "runas" can't be used to run a command line with elevated privileges .
runas /showtrustlevels and /trustlevel seems to be, at best, a Microsoft "work in progress"...completly useless IMHO
Extract from http://msdn.microsoft.com/en-us/library/bb756922.aspx :
../..
Do Not Use Runas to Launch an Elevated Process
The Run as… option from Windows XP and Windows Server 2003 has been replaced withRun as administrator on the context menu (available when you right-click an executable) in Windows Vista. When a standard user selects theRun as administrator option, the user is presented with a list of active administrators on the local computer. Standard users with higher privileges, such as members of the Backup Operators group, are also displayed. When an administrator selects the Run as administrator option, a User Account Control dialog box immediately prompts the user to continue before running the application.
Users must use the runas command at the command prompt in order to run an application as another user.
Important
Be aware that runas does not provide the ability to launch an application with an elevated access token, regardless of whether it is a standard user with privileges like a Backup Operator or an administrator. The runas command grants the user the ability to launch an application with different credentials. The best method to use to launch an application with a different account is to perform the action programmatically by using a service and not rely on the user to run the component as a different user. If your program programmatically uses the runas command, ensure that it is not intended to launch an elevated process.
../..
Instead, use the "Elevation Powertoys" : http://technet.microsoft.com/en-us/magazine/2008.06.elevation.aspx,
(maybe a updated version here :
http://blogs.technet.com/b/deploymentguys/archive/2009/01/21/the-elevation-powertoys-and-windows-7.aspx ?)
"UAC confirmation" will always pop-up (if your UAC parameters don't disable it)
Hope this help
jean-marc haby
runas /showtrustlevels and /trustlevel seems to be, at best, a Microsoft "work in progress"...completly useless IMHO
Extract from http://msdn.microsoft.com/en-us/library/bb756922.aspx :
../..
Do Not Use Runas to Launch an Elevated Process
The Run as… option from Windows XP and Windows Server 2003 has been replaced withRun as administrator on the context menu (available when you right-click an executable) in Windows Vista. When a standard user selects theRun as administrator option, the user is presented with a list of active administrators on the local computer. Standard users with higher privileges, such as members of the Backup Operators group, are also displayed. When an administrator selects the Run as administrator option, a User Account Control dialog box immediately prompts the user to continue before running the application.
Users must use the runas command at the command prompt in order to run an application as another user.
Important
Be aware that runas does not provide the ability to launch an application with an elevated access token, regardless of whether it is a standard user with privileges like a Backup Operator or an administrator. The runas command grants the user the ability to launch an application with different credentials. The best method to use to launch an application with a different account is to perform the action programmatically by using a service and not rely on the user to run the component as a different user. If your program programmatically uses the runas command, ensure that it is not intended to launch an elevated process.
../..
Instead, use the "Elevation Powertoys" : http://technet.microsoft.com/en-us/magazine/2008.06.elevation.aspx,
(maybe a updated version here :
http://blogs.technet.com/b/deploymentguys/archive/2009/01/21/the-elevation-powertoys-and-windows-7.aspx ?)
"UAC confirmation" will always pop-up (if your UAC parameters don't disable it)
Hope this help
jean-marc haby
相关文章推荐
- 面向对象
- Java偏量锁
- JAR文件最小体积发布
- postgres9.3手册-I部分-笔记7章
- tomcat jboss 對於CPU及內存佔用過高的分析
- 【案例】云盒子私有云在电子技工学校的建设
- js正则表达式
- IOS应用程序多语言本地化解决方案
- 昨天是我的生日
- 正则表达式一些关键字使用
- 利用Maple计算积分操作方法
- Maple编程时调用函数教程
- Innodb中的事务隔离级别和锁的关系
- hr样式设定
- sscanf用法总结
- 穷的看不起朋友圈了?wemall不走朦胧路线,鲜明个性看得见
- EDIUS中的视频怎么才能添加字幕?
- Bootstrap 输入框组
- Bootstrap 导航元素
- Bootstrap 导航栏