How to use Windows commands to determine whether a batch is running at the highest level of administrator rights

Source: Internet
Author: User
  1. @echo off
    At > nul
    If%errorlevel% equ 0 (Echo OK) else echo guest switch to a administrator account to run this batch!!!

  2. @echo off
    whoami/groups | Find "s-1-16-12288" >nul
    If ERRORLEVEL 1 (echo [ERROR] This script have to is executed with administrator privilegs) else echo [OK]

This article is from the "Hometown Lights Fire" blog, please make sure to keep this source http://ispart.blog.51cto.com/5816769/1952906

How to use Windows commands to determine whether a batch is running at the highest level of administrator rights

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.