Question: How do I run a batch file from another batch file with administrator rights?

I have tried the [RUNAS](http://ss64.com/nt/runas.html) command, but it requires the administrator password.

I am searching for an alternative for running a batch file by right clicking on it and running as an administrator. I want to automate it from another batch file.

Answer: 
Put each line in cmd or all of theme in the batch file:

```
@echo off

if not "%1"=="am_admin" (powershell start -verb runas '%0' am_admin & exit /b)

"Put your command here"

```

it works fine for me.
You can use [PowerShell](http://en.wikipedia.org/wiki/Windows_PowerShell) to run b.bat as administrator from `a.bat`:

```
set mydir=%~dp0

Powershell -Command "& { Start-Process \"%mydir%b.bat\" -verb RunAs}"

```

It will prompt the user with a confirmation dialog. The user chooses `YES`, and then `b.bat` will be run as administrator.