rudi Posted November 9, 2017 Share Posted November 9, 2017 Hello. Windows shortcuts have the option to check "Run as administrator" in the "advanced settings" on the tab "Shortcut" Is it possible to use the function FileCreateShortcut() to define this? Or to use this function and modify this option afterwards? Is it possible to "read" this option's current state for a given LNK file? (FileGetShortcut() doesn't seem to offer that?) Regards, Rudi. Earth is flat, pigs can fly, and Nuclear Power is SAFE! Link to comment Share on other sites More sharing options...
gruntydatsun Posted November 9, 2017 Share Posted November 9, 2017 Link to comment Share on other sites More sharing options...
rudi Posted November 9, 2017 Author Share Posted November 9, 2017 Hi, thanks for your reply. HKCU\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers Wasn't aware that this place in the registry does exist. Regards, Rudi. Earth is flat, pigs can fly, and Nuclear Power is SAFE! Link to comment Share on other sites More sharing options...
rudi Posted November 10, 2017 Author Share Posted November 10, 2017 (edited) Hello. at that Registry Key it looks like, that values with the name "EXE-full-file-path-name" are created at the moment, that EXE was started for a first time. Example: RegistryValue (REG_SZ) "H:\DATEN\PUBLIC\Kataloge\Festo\DKI3\xDKIBrowser.EXE" = "DisableNXShowUI" Where the "Checkbox" status is stored, I couldn't figure out so far. Modifyiong the CheckBox status doesn't seem to alter the according registry value, even not if the EXE is started again. Any suggestions? Regards, Rudi. Edited November 10, 2017 by rudi typo Earth is flat, pigs can fly, and Nuclear Power is SAFE! Link to comment Share on other sites More sharing options...
Juvigy Posted November 15, 2017 Share Posted November 15, 2017 Why would you need to create a shortcut with autoit to run as admin when you can just runas with elevated credentials? Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted November 15, 2017 Moderators Share Posted November 15, 2017 @Juvigy There could be a number of reasons. I have done it often when pushing out a shortcut to 1000 desktops through a deployment suite like SCCM. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
Earthshine Posted November 15, 2017 Share Posted November 15, 2017 well, it's been done... apparently you can do it with a registry entry. http://forums.winamp.com/showthread.php?t=278764 Quote OK, I am not sure if there is something is wrong with this method, but I came across this and have not seen a reference to it anywhere on NSIS forum. I think it is way easier than anything else proposed here and seems to work great.Basically the "Run As Administrator" is simply a registry value stored in "Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\layers" , so you can use: code: WriteRegStr HKLM "Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\layers" \ "$MY_SHORCUT_OR_EXE" "RUNASADMIN" Obviously replace $MY_SHORCUT_OR_EXE with your executable or shortcut. You can replace HKLM with HKCU for user specific setting instead of all users.I figured I'd share.-HH My resources are limited. You must ask the right questions Link to comment Share on other sites More sharing options...
rudi Posted November 16, 2017 Author Share Posted November 16, 2017 Thanks for your replies. I'm still not really seeing where the *CHECKBOX STATUS* is instantly stored, without running the associated EXE at least once. Meanwhile the vendor of this catalog software has provided a bug fix, so that the need to be run with "as Administrator" is eliminated. It's a new version of a file named xDKIFrameworkComponents.bpl Regards, Rudi. Earth is flat, pigs can fly, and Nuclear Power is SAFE! Link to comment Share on other sites More sharing options...
jguinch Posted November 16, 2017 Share Posted November 16, 2017 maybe with @mLipok 's UDF : Spoiler Network configuration UDF, _DirGetSizeByExtension, _UninstallList Firefox ConfigurationArray multi-dimensions, Printer Management UDF Link to comment Share on other sites More sharing options...
KaFu Posted November 16, 2017 Share Posted November 16, 2017 My version is 3,5 years older :)... mLipok 1 OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2024-Oct-13) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Oct-13) HMW - Hide my Windows (2024-Oct-19) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2024-Oct-20) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
rudi Posted November 17, 2017 Author Share Posted November 17, 2017 Thanks for your replies. I'm still not really seeing where the *CHECKBOX STATUS* is instantly stored, without running the associated EXE at least once. Meanwhile the vendor of this catalog software has provided a bug fix, so that the need to be run with "as Administrator" is eliminated. It's a new version of a file named xDKIFrameworkComponents.bpl Regards, Rudi. Earth is flat, pigs can fly, and Nuclear Power is SAFE! Link to comment Share on other sites More sharing options...
KaFu Posted November 17, 2017 Share Posted November 17, 2017 14 hours ago, rudi said: I'm still not really seeing where the *CHECKBOX STATUS* is instantly stored, without running the associated EXE at least once. RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers", @ScriptFullPath, "REG_SZ", "RUNASADMIN") OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2024-Oct-13) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Oct-13) HMW - Hide my Windows (2024-Oct-19) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2024-Oct-20) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
Danyfirex Posted November 18, 2017 Share Posted November 18, 2017 Hello You can do this: Local $sShortcut = "C:\Users\User\Desktop\someshortcut.lnk" _SetShortcutRunAsAdmin($sShortcut);Enable-Set advanced settings Run as administrator true ;~ _SetShortcutRunAsAdmin($sShortcut,False);Disable-Set advanced settings Run as administrator false Func _SetShortcutRunAsAdmin($sShortcutFullPath, $bRunAsAdmin = True) Local $hFile = FileOpen($sShortcutFullPath, 17) FileSetPos($hFile, 21, 0) FileWrite($hFile, $bRunAsAdmin ? 0x20 : 0x00) FileClose($hFile) EndFunc ;==>_SetShortcutRunAsAdmin Saludos Earthshine 1 Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut Link to comment Share on other sites More sharing options...
rudi Posted December 1, 2017 Author Share Posted December 1, 2017 @Danyfirex thanks, I'll try that one, looks great. Where from did you grab the information for that offset within the LNK file? Regards, Rudi. Earth is flat, pigs can fly, and Nuclear Power is SAFE! Link to comment Share on other sites More sharing options...
Danyfirex Posted December 1, 2017 Share Posted December 1, 2017 I found that trick time ago in stack overflow written in another lenguage. I don't remeber the thread. Saludos Earthshine 1 Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now