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-07-18 10:48
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » [Help] How to automatically enter the password using the runas command? View 2,576 Replies 7
Original Poster Posted 2007-10-20 11:28 ·  中国 四川 成都 电信
初级用户
Credits 80
Posts 41
Joined 2007-10-05 14:44
18-year member
UID 98965
Gender Male
Status Offline
I want to use runas in the users group to open IIS in the administrators group.
I used this command: runas /user:admin cmd
Then open it.
But it prompts for a password. I want to input the password automatically. Can it be done?

[ Last edited by lxmxn on 2007-10-21 at 10:53 PM ]
http://user.qzone.qq.com/182365808
Floor 2 Posted 2007-10-20 12:23 ·  中国 四川 成都 电信
初级用户
Credits 80
Posts 41
Joined 2007-10-05 14:44
18-year member
UID 98965
Gender Male
Status Offline
Please provide the specific content in Chinese that needs to be translated so that I can assist you. Just the repeated "help" alone doesn't have the Chinese content to translate.
Recent Ratings for This Post ( 2 in total) Click for details
RaterScoreTime
lxmxn -4 2007-10-20 13:46
knoppix7 -4 2007-10-20 14:19
http://user.qzone.qq.com/182365808
Floor 3 Posted 2007-10-20 13:46 ·  中国 湖北 武汉 电信
版主
★★★★★
Credits 11,386
Posts 4,938
Joined 2006-07-23 17:10
19-year member
UID 59080
Status Offline
Don't post non-substantive messages. Also, your question can be searched; there have already been discussions in the forum.
Floor 4 Posted 2007-10-21 04:29 ·  中国 上海 联通
版主
★★★★★
Credits 9,023
Posts 5,017
Joined 2007-05-31 19:39
19-year member
UID 89899
Gender Male
Status Offline
When you learn to search, you learn to study: )
Method 1: Use VBS's SendKeys to enter the password
echo set pws=WScript.CreateObject("WScript.Shell")>%temp%\pws.vbs
echo pws.SendKeys "1{ENTER}">>%temp%\pws.vbs
wscript %temp%\pws.vbs&runas /u:test1 cmd.exe

Method 2: Use the /savecred parameter
When an independent user executes the program for the first time, a credential needs to be established. During this time, the password input will not be echoed, you can't see it, just enter and press Enter after inputting.
There is no need to enter the password when running later.
runas /u:test1 cmd.exe Enter the password and press Enter
runas /savecred /u:test1 explorer No need to enter the password

Method 3: Use PsExec from PsTools tool to replace Runas
Floor 5 Posted 2007-10-21 10:57 ·  中国 四川 成都 电信
初级用户
Credits 80
Posts 41
Joined 2007-10-05 14:44
18-year member
UID 98965
Gender Male
Status Offline
Thanks, but it seems that you need to enter it for the first time and then you don't need to enter it. What I want to do is put the password in a bat file, open the bat file to open the authorized IIS without me entering the password, and then encrypt it for others to use. I'm a computer room administrator!
    Which expert can help write it?
http://user.qzone.qq.com/182365808
Floor 6 Posted 2007-10-22 12:11 ·  中国 四川 成都 电信
初级用户
Credits 80
Posts 41
Joined 2007-10-05 14:44
18-year member
UID 98965
Gender Male
Status Offline
It seems that you all need to enter the password for the first time, and then you don't need to enter it later. Which expert can help write it?
http://user.qzone.qq.com/182365808
Floor 7 Posted 2007-10-22 16:43 ·  中国 山东 青岛 联通
初级用户
Credits 21
Posts 7
Joined 2005-09-14 16:22
20-year member
UID 42509
Status Offline
I find they are all not very reliable
Similar to makemeadmin, runasspc, etc.
Floor 8 Posted 2007-10-25 19:14 ·  中国 陕西 西安 电信
初级用户
Credits 94
Posts 36
Joined 2005-09-19 01:08
20-year member
UID 42619
Status Offline
The system's automatic command line cannot achieve this function (so far as my personal research goes)

Only third-party software can be relied on.

For details, please refer to the relevant articles in http://awera.tianya.cn
Problem solved!
Forum Jump: