I need to run a batch file which needs to register a DLL. The DLL registration is failing because the Batch file is not starting the command prompt as \"administrator\".
This Works for me`in Windows 7 to 10 with parameters and also kick starting app or file from any where(including browser) and also accessing file from anywhere,Replace (YOUR BATCH SCRIPT HERE anchor) with your code ,This solution May Help :)
@echo off
call :isAdmin
if %errorlevel% == 0 (
goto :run
) else (
echo Requesting administrative privileges...
goto :UACPrompt
)
exit /b
:isAdmin
fsutil dirty query %systemdrive% >nul
exit /b
:run
exit /b
:UACPrompt
echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
echo UAC.ShellExecute "cmd.exe", "/c %~s0 %~1", "", "runas", 1 >> "%temp%\getadmin.vbs"
"%temp%\getadmin.vbs"
del "%temp%\getadmin.vbs"
exit /B`