Skip to content

is-elevated command #118

@zdm

Description

@zdm

Description of the new feature / enhancement

Could you please add new is-elevated command.
It should check for elevated permissions and return 0 if process is already elevated.

sudo is-elevated && echo Already elevated

Scenario when this would be used?

This is useful feature and can be used in many scenarios.

For example if will allow to create self-elevated scripts:

test.cmd:

:: check for elevated permissions
:: - if already elevated - continue run
:: - if NOT elevated - elevate myself, run and exit
sudo is-elevated || ( sudo -E "%~sf0" %* & exit /B )

echo Run elevated code here

Supporting information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-FeatureNew feature or request. Complex enough to require planning and actual budgeted, scheduled work.Needs-TriageIt's a new issue that the core contributor team needs to triage at the next triage meeting

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions