You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
From time to time i let users install Dr. Mingw and it’s a bit weird to tell them that they have to open an Admin command prompt, navigate to the extracted folder and execute some command to get it working.
Logic like this could imo be implemented as part of the usage prompt that comes up if you execute drmingw.exe in the explorer, but i currently simply share the following script which could be included as is without much further work needed:
REM http://stackoverflow.com/questions/1894967/how-to-request-administrator-access-inside-a-batch-file#10052222
@echo off
:: BatchGotAdmin
:-------------------------------------
REM --> Check for permissions
IF "%PROCESSOR_ARCHITECTURE%" EQU "amd64" (
>nul 2>&1 "%SYSTEMROOT%\SysWOW64\cacls.exe" "%SYSTEMROOT%\SysWOW64\config\system"
) ELSE (
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
)
REM --> If error flag set, we do not have admin.
if '%errorlevel%' NEQ '0' (
echo Requesting administrative privileges...
goto UACPrompt
) else ( goto gotAdmin )
:UACPrompt
echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
set params = %*:"=""
echo UAC.ShellExecute "cmd.exe", "/c ""%~s0"" %params%", "", "runas", 1 >> "%temp%\getadmin.vbs"
"%temp%\getadmin.vbs"
del "%temp%\getadmin.vbs"
exit /B
:gotAdmin
pushd "%CD%"
CD /D "%~dp0"
:--------------------------------------
"%CD%/bin/drmingw.exe" -i
The text was updated successfully, but these errors were encountered:
It would be better to avoid batch, and have drmingw to call itself again with elevator priviledges, and the same command line parameters, as exemplified in https://stackoverflow.com/a/6418873
From time to time i let users install Dr. Mingw and it’s a bit weird to tell them that they have to open an Admin command prompt, navigate to the extracted folder and execute some command to get it working.
Logic like this could imo be implemented as part of the usage prompt that comes up if you execute
drmingw.exe
in the explorer, but i currently simply share the following script which could be included as is without much further work needed:The text was updated successfully, but these errors were encountered: