中国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-01 18:50
47,817 topics / 349,919 posts / today 0 new / 48,265 members
DOS批处理 & 脚本技术(批处理室) » [Help] How to automatically enter the password using the runas command?
Printable Version  2,668 / 7
Floor1 putao Posted 2007-10-20 11:28
初级用户 Posts 41 Credits 80
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 ]
Floor2 putao Posted 2007-10-20 12:23
初级用户 Posts 41 Credits 80
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.
Floor3 lxmxn Posted 2007-10-20 13:46
版主 Posts 4,938 Credits 11,386
Don't post non-substantive messages. Also, your question can be searched; there have already been discussions in the forum.
Floor4 HAT Posted 2007-10-21 04:29
版主 Posts 5,017 Credits 9,023
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
Floor5 putao Posted 2007-10-21 10:57
初级用户 Posts 41 Credits 80
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?
Floor6 putao Posted 2007-10-22 12:11
初级用户 Posts 41 Credits 80
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?
Floor7 StarWorld Posted 2007-10-22 16:43
初级用户 Posts 7 Credits 21
I find they are all not very reliable
Similar to makemeadmin, runasspc, etc.
Floor8 awera Posted 2007-10-25 19:14
初级用户 Posts 36 Credits 94
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!
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023