中国DOS联盟论坛

China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
Guest | Log in | Register | Members | Search | China DOS Union
中国DOS联盟论坛
The time now is 2026-09-23 13:03
47,812 topics / 349,917 posts / today 0 new / 48,273 members
DOS批处理 & 脚本技术(批处理室) » Using the runas command in Windows 7 (instead of right-clicking "Run as administrator")
Printable Version  3,120 / 1
Floor1 zzkwhl Posted 2017-08-13 07:47
新手上路 Posts 1 Credits 3
In Windows 7, due to User Account Control, using cmd is not very convenient because of permission issues. For example, the simplest thing, entering "net start mssqlserver" (to start the SQL Server service), will prompt "Access is denied". The simplest solution is to right-click and select "Run as administrator" to obtain permissions.



Now I find this is not convenient either, so I thought if there is any command that can achieve this effect. After checking, it's "runas".



Enter "runas /?" in cmd to view the help. Actually, all I need is to run with an administrator account. Enter "runas /user:administrator cmd" (run cmd with administrator), then it will ask for the password. After entering the password, an error occurs: "RUNAS error: Unable to run - cmd 1058: The service cannot be started. The reason could be that it is disabled or there is no associated device started."

This is because the "Secondary Logo" service is not started. This service is "Enable the startup process under different credentials". Directly enter services.msc in cmd, change the service from disabled to manual, then enter the runas command again, and a new cmd window will pop up, and it will run with the administrator account, and the permission issue is solved.
Floor2 eech Posted 2017-08-17 00:22
高级用户 Posts 346 Credits 906
Hey, there are still brothers sticking to posting on this forum. I haven't been here for several years.
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023