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:

  1. click on windows icon
  2. type cmd in the search bar
  3. press Ctrl + Shift + Enter
  4. 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