1.

Solve : RUNAS command?

Answer»

I just have a quick question here. I am working on a BATCH file to fix a current problem on my network, and i'm running into a roadblock. I'm trying to use the RUNAS command to run a file as an administrator for it to work properly, and i was wondering if there is a WAY to have the admin password inputted automatically when prompted to. I'm running Windows 2000 server and windows 2000 professional for the workstations. Any help is going to be greatly appreciated. Thank you.This might work...It isn't COMPLAINING to me on runas syntax errors or authentication when swapping out the UserName with a valid user name and Password with my local password for that admin user. My one Windows 2000 system in my stack of computers launches the program mspaint.exe under the local admin privileges. I grabbed this off of a google hit, and added for mspaint.exe to launch. I also added the Pause to see if there are any complaints vs having the shell window close.

@ECHO OFF
SET USERNAME=UserName
SET PASSWORD=Password
ECHO %PASSWORD%|runas /user:%USERNAME% %~1 |mspaint.exe
echo on
pause


*** This is dangerous though, if KEPT in batch form because the password will be not encrypted and wide open ***

If you need security with the runas in a batch, I would use a Batch *.Bat to Executable *.EXE compiler to give it al least some defense from being able to be opened with a text editor etc.

http://www.softpedia.com/get/System/File-Management/Batch-To-Exe-Converter.shtml


Hope this works as it should according to the google hit ..... Dave



Discussion

No Comment Found