China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-08-01 10:17
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » Using the runas command in Windows 7 (instead of right-clicking "Run as administrator") View 2,881 Replies 1
Original Poster Posted 2017-08-13 07:47 ·  中国 北京 联通
新手上路
Credits 3
Posts 1
Joined 2017-08-12 16:49
8-year member
UID 182458
Gender Male
Status Offline
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.
Recent Ratings for This Post ( 1 in total) Click for details
RaterScoreTime
zzz19760225 +2 2017-08-13 08:46
Floor 2 Posted 2017-08-17 00:22 ·  中国 安徽 芜湖 电信
高级用户
★★★
Credits 906
Posts 346
Joined 2006-07-10 09:58
20-year member
UID 58334
Gender Male
Status Offline
Hey, there are still brothers sticking to posting on this forum. I haven't been here for several years.
Forum Jump: