How do I know if I have Windows administrator rights from command line?
Solution 1:
You can run the following script:
NET SESSION >nul 2>&1
IF %ERRORLEVEL% EQU 0 (
ECHO Administrator PRIVILEGES Detected!
) ELSE (
ECHO NOT AN ADMIN!
)
By the way, you can start command prompt with administrative privileges:
- click on windows icon
- type
cmd
in the search bar - press Ctrl + Shift + Enter
- press Ctrl+C or click on "yes" when the UAC message appears
Related question answered on stackoverflow:
https://stackoverflow.com/questions/4051883/batch-script-how-to-check-for-admin-rights