I've changed something on my batch file, how can I get it started as administrator if a user press a key?
echo Checking for Administrator elevation...
openfiles > NUL 2>&1
if %errorlevel%==0 (
echo Elevation found! Proceeding...
goto menu
) else (
echo You are not running as Administrator...
echo This batch cannot do it's job without elevation!
echo.
echo Right-click and select ^'Run as Administrator^' and try again...
echo.
echo Press any key to exit...
pause > NUL
exit
)
I know that it currently closes the script when there is no admin right, I want to start it as admin without closing it again.
This solved my problem.