Launching a shortcut "as admin" Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
JBensimon
Posts: 118
Joined: 19 Nov 2017, 11:19

Launching a shortcut "as admin"

09 Oct 2023, 12:43

Is there a more direct way to launch a shortcut elevated than

Code: Select all

Run, *RunAs cmd.exe /c "path\shortcut.lnk",, Hide
i.e. without the help of CMD and without extracting & launching the target of the shortcut? I can't think of any.

JB
RussF
Posts: 1298
Joined: 05 Aug 2021, 06:36

Re: Launching a shortcut "as admin"  Topic is solved

09 Oct 2023, 14:22

I'm not 100% sure what you're asking, but this works for me:

Code: Select all

Run, *RunAs path\shortcut.lnk
If you don't want to use a shortcut, just use the path to the executable file, i.e.

Code: Select all

Run, *RunAs C:\Windows\System32\notepad.exe

; or if the app folder is in your Path environment variable

Run, *RunAs Notepad.exe
Russ
JBensimon
Posts: 118
Joined: 19 Nov 2017, 11:19

Re: Launching a shortcut "as admin"

09 Oct 2023, 14:50

Wow, just realized that your first suggestion wasn't working for me because, by a quirk of how I was assembling the Run parameter, there were two spaces between *RunAs and path\shortcut.lnk, which yields a "file not found" error and was the reason I posted the question in the first place.

Thanks for forcing me to look again!

JB

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: No registered users and 158 guests