-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathisAdmin
More file actions
25 lines (22 loc) · 722 Bytes
/
isAdmin
File metadata and controls
25 lines (22 loc) · 722 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
rem This program has been tested on Windows 7, 8, 8.1, and 10
@echo off
title Check That Something Is Running As Administrator
ver
echo.
echo.
echo Administrative permissions required. Detecting permissions...
net session >nul 2>&1
if %errorLevel% == 0 (
echo Success: Administrative permissions confirmed.
echo.
echo Put File or Code Here
echo.
) else (
echo Failure: Current permissions inadequate.
echo Attempting elevate permissions.
rem Restart Process Running As Administrator
echo Replace path in the code below to the path to your program
echo.
echo. Then delete this block and uncomment the code below by deleting rem
rem runas.exe /noprofile /user:.\Administrator %USERPROFILE%\Desktop\path
)