RunAs - explaining example from the docs

Get help with using AutoHotkey and its commands and hotkeys
john_c
Posts: 148
Joined: 05 May 2017, 13:19

RunAs - explaining example from the docs

20 Jul 2018, 17:01

Here is an example from the docs. I'm trying to understand what RegExMatch(full_command_line, " /restart(?!\S)") is doing. I tested this code and it seems we could simply remove RegExMatch part without any difference in the behaviour. But probably I miss something?

https://autohotkey.com/docs/commands/Run.htm#RunAs:

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus

Last edited by john_c on 20 Jul 2018, 17:21, edited 1 time in total.
User avatar
gregster
Posts: 1350
Joined: 30 Sep 2013, 06:48

Re: RunAs - explaining example from the docs

20 Jul 2018, 17:13

https://autohotkey.com/docs/commands/Run.htm#RunAs:
If UAC is disabled, *RunAs will launch the process without elevating it. Checking for /restart in the command line ensures that the script does not enter a runaway loop in that case.
As I understand it, it prevents an endless re-start loop, if the restart with elevated rights failed (because of disabled UAC) the first time (if it was restarted by this snippet, the /restart string will appear in the command line, compare the RunAs lines). If it could not fail, it could probably be left out.

Ps.: Would be cool next time, if you could directly link to the doc page where you took it from.

Return to “Ask For Help”

Who is online

Users browsing this forum: nonvenomous, wideeyedguy and 49 guests