Greetings, Mark Liam Brown!

> How can I modify a Cygwin bash script so it runs in elevated
> Administrator mode when someone double-clicks it in Windows Explorer?

Add a block that runs an admin only command and check for exit code.
The `net session` or `openfiles` commands are a good candidate for a target of
such check.

Smth. along the lines of

if ! openfiles > /dev/null 2>&1; then
    # Some command to restart the program elevated
    exit 1
fi

Though, I'm using takecommand's free runtime (TCC-RT), which has an explicit
START /ELEVATED command, and I'm using a wrapper for such tasks.

Though, in hindsight, just creating an .LNK with "run as administrator"
checkbox set in properties should suffice.


-- 
With best regards,
Andrey Repin
Friday, April 11, 2025 19:26:03

Sorry for my terrible english...

-- 
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple

Reply via email to