Main Forum > General Computer Support
Send to Set Always Run As Admin no longer working
madhouserevival:
I don't know how this happened. Was working a few weeks ago. Now I just get a blank cmd window. Including a short video showing what's happening. I even removed ALL context menu tweaks in case they were interfering. Also, ran the AIO repair tool. Somewhere I borked something! https://youtu.be/PGqZ-cSfvrk
Shane:
Go to the bat file itself and check it, right click and hit edit and make sure nothing has changed it.
Shane
madhouserevival:
Redownloaded it just in case, but here is the contents:
--- Quote --- @echo off
setlocal enableDelayedExpansion
:::::::::::::::::::::::::::::::::::::::::
:: Automatically check & get admin rights
:::::::::::::::::::::::::::::::::::::::::
:checkPrivileges
NET FILE 1>NUL 2>NUL
if '%errorlevel%' == '0' ( goto gotPrivileges ) else ( goto getPrivileges )
:getPrivileges
ECHO.
ECHO **************************************
ECHO Invoking UAC for Privilege Escalation
ECHO **************************************
setlocal DisableDelayedExpansion
set "batchPath=%~0"
setlocal EnableDelayedExpansion
ECHO Set UAC = CreateObject^("Shell.Application"^) > "%temp%\OEgetPrivileges.vbs"
ECHO UAC.ShellExecute "!batchPath!", "%*", "", "runas", 1 >> "%temp%\OEgetPrivileges.vbs"
"%temp%\OEgetPrivileges.vbs"
exit /B
:gotPrivileges
::::::::::::::::::::::::::::
:START
::::::::::::::::::::::::::::
@echo off
setlocal ENABLEDELAYEDEXPANSION
rem Take the cmd-line, remove all until the first parameter
set "params=!cmdcmdline:~0,-1!"
set "params=!params:*" =!"
set count=0
rem Split the parameters on spaces but respect the quotes
for %%G IN (!params!) do (
set /a count+=1
set "item_!count!=%%~G"
rem echo !count! %%~G
)
rem list the parameters
for /L %%n in (1,1,!count!) DO (
set "strexe=!item_%%n!"
set "strexe=!strexe:~-3!"
IF /I ["!strexe!"] EQU ["exe"] reg add "HKCU\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags" /f
IF /I ["!strexe!"] EQU ["exe"] reg add "HKCU\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers" /f
IF /I ["!strexe!"] EQU ["exe"] reg add "HKCU\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers" /v "!item_%%n!" /t REG_SZ /d "RUNASADMIN" /f
IF /I ["!strexe!"] EQU [".ex"] reg add "HKCU\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags" /f
IF /I ["!strexe!"] EQU [".ex"] reg add "HKCU\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers" /f
IF /I ["!strexe!"] EQU [".ex"] reg add "HKCU\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers" /v "!item_%%n!e" /t REG_SZ /d "RUNASADMIN" /f
)
exit
--- End quote ---
I ran into this with windows 8.1 before, but this time I'm in Windows 7 Pro. It was working about a month ago. I've no idea what could be affecting it. Thanks, Shane.
Shane:
What the bat file does is make a script file and runs it to see if it gets a result, forcing the UAC to ask for permissions, onces it has permissions it then takes the file you dropped onto it and adds it to the registry.
So from the looks of it, it might be that the UAC isnt getting triggered so the bat file isnt getting permission to write to the registry. Have you tried having the bat file set to always run as administrator?
Shane
madhouserevival:
Hi, ironically that option is grayed out I'm afraid. All other bat files on my computer have it grayed out at well. I'm going to try to add it manually to the registry. Will report back. BTW do place it in
--- Quote ---HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers
--- End quote ---
or
--- Quote ---HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers
--- End quote ---
Added it to both, still not working. :confused:
Navigation
[0] Message Index
[#] Next page
Go to full version