Main Forum > General Computer Support
[Solved] Shortcuts from start to 'Run as administrator' don't work (Win 8.1 x64)
Shane:
Thanks :-)
It is good to be back working. Been a long past 8 days.
Ok as for the UAC, A while back I made a bat file for a user where he added the bat file to the right click send to menu, and he could send a file to the bat file and it would put a check on the compatibility page for it to always run it as an administrator.
That information is stored in the registry, so we should check there as if there is a registry key that is set for say all shortcut .lnk files that could explain what is happening, windows is following what ever rule is set in the registry and not asking for the administrator permissions. But when you run a exe directly it does.
So this ws the bat file code here
--- Code: --- @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 code ---
In that code you will see the registry location where the info is set.
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
Go to that location in the registry and let me know if you have anything there, if you do, export it out to a file and post it for me so I can look it over. :wink:
Shane
George:
I'm sorry, I must be even dumber than I look.
'In that code you will see the registry location where the info is set.' I can't, where is it? :shocked:
'Go to that location in the registry and let me know if you have anything there, if you do, export it out to a file and post it for me so I can look it over.' I can only back up the whole registry, how to export out a part of it? :confused:
Shane:
No worries :-)
--- Quote ---HKCU\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags
--- End quote ---
So HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags
Right click on the section and you will have a export option.
Go ahead and check another location as well, HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags
And export that out as well.
HKEY_CURRENT_USER is the current logged in user registry location while HKEY_LOCAL_MACHINE is the system wide registry location. So I like to check both locations.
Shane
George:
Thanks a lot :cheesy:
Please find enclosed the two exported files.
Shane:
Great :-)
I am pulling a late night working on the windows repair toolbox, so I will be on for a while. While I look these over I want you to do one more test for me. This test will tell me if the problem is on the system side or current profile.
Create a new user account on the system and log into that account and see if you have the same problem. If you do then I know it is on the system side, if it works on the new account then I know it is on the current user side :wink:
Shane
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version