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: 
CMD Itself does not have a function to run files as admin, but powershell does, and that powershell function can be exectuted through CMD with a certain command. Write it in command prompt to run the file you specified as admin.

```
powershell -command start-process -file yourfilename -verb runas

```

Hope it helped!
The complete solution I found that worked was:

```
@echo off
cd /D "%~dp0"
if not "%1"=="am_admin" (powershell start -verb runas '%0' am_admin & exit /b)
"Put your command here"

```

credit for:
<https://stackoverflow.com/a/51472107/15087068>

<https://serverfault.com/a/95696>