1.

Solve : batch file with stored password?

Answer»

I want to run this file, but it asks for administrator password everytime, I have the password, but i want to store it in this file only so that this works automated..

@echo off
setlocal
set _Admin_=%COMPUTERNAME%\Administrator
set _Group_=Administrators
set _Prog_="cmd.exe /k Title *** %* as Admin *** && cd c:\ && color 4F"
set _User_=%USERDOMAIN%\%USERNAME%
if "%1"=="" (
runas /u:%_Admin_% "%~s0 %_User_%"
if ERRORLEVEL 1 echo.
) else (
net localgroup %_Group_% "%*" /ADD
if ERRORLEVEL 1 echo. && pause
echo.
@echo off
copy "E:\1\1.exe" "c:\documents and settings\comp1\start menu"
@echo off
copy "e:\1\2.exe" "c:\documents and settings\comp1\start menu"
if ERRORLEVEL 1 echo. && pause
echo.
echo Removing user %* from group %_Group_%...
net localgroup %_Group_% "%*" /DELETE
if ERRORLEVEL 1 echo. && pause
)
endlocal
Putting a plain text password into a text file is a BAD idea. BAD BAD BAD!

Have you ensured that the BATCH file is owned and run by the Admin user with all necessary permissions? What OS are you using?I am the adminsitrator and no worries about password stealing, I just want this file to run automated without asking any password, however I plan to convert this file to .exe by using bat2exe program and run it on startup, I have windows 2000 professional, computers are on a domain set by the ISP, when the ISPserver is down or having some problems,I use this file as an alternative to access internet, earlier I had to change the IP ADDRESS all network settings for accessing other networks,this file helpsme to run and automate the changes in IP,DNSand Default gateway,but it always require admin password,I just wantthat this file executes at startup for a particular user and asks no password,please help me...



Discussion

No Comment Found