0

I have a batch file for Win 10: run.bat

Within the batch file, I want to run Regini (app to modify registry permissions).

regini run.bat

I tested this line using CMD prompt. Regular prompt does not work. But if I run CMD prompt "as admin", it works.

Run.bat contains HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies [9]

QUESTION: Is there a way to run "regini" as admin from within a batch file?

nanonerd
  • 1,964
  • 6
  • 23
  • 49

1 Answers1

0

from what you explain, this could be the solution you're looking for. If the batch runs "as admin", all executed commands within will do as well.

set "params=%*" 
cd /d "%~dp0" && ( if exist "%temp%\getadmin.vbs" del "%temp%\getadmin.vbs" ) && fsutil dirty query %systemdrive% 1>nul 2>nul || (  echo Set UAC = CreateObject^("Shell.Application"^) : UAC.ShellExecute "cmd.exe", "/k cd ""%~sdp0"" && %~s0 %params%", "", "runas", 1 >> "%temp%\getadmin.vbs" && "%temp%\getadmin.vbs" && exit /B )

the original post and more explanation can be found here How to code a BAT file to always run as admin mode?

Mahobo
  • 105
  • 1
  • 16