update template
This commit is contained in:
parent
7bc2cce2bd
commit
7122e96ad1
36
script.cmd
Normal file
36
script.cmd
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
pushd "%~dp0"
|
||||||
|
@echo off
|
||||||
|
goto :Start
|
||||||
|
|
||||||
|
--------------------------------------------------
|
||||||
|
Returning current username if privileged rights are exist
|
||||||
|
or
|
||||||
|
returning error, if privileged rights are not exist
|
||||||
|
|
||||||
|
Positional parameters:
|
||||||
|
[1] qn - execution without pauses
|
||||||
|
|
||||||
|
Administrator rights required.
|
||||||
|
--------------------------------------------------
|
||||||
|
|
||||||
|
:Start
|
||||||
|
set basename=%~n0
|
||||||
|
|
||||||
|
:Admin_Check
|
||||||
|
openfiles >nul 2>&1
|
||||||
|
if %errorLevel% == 0 (
|
||||||
|
set code=0
|
||||||
|
) else (
|
||||||
|
set code=5
|
||||||
|
cls
|
||||||
|
echo Restart this as Administrator!
|
||||||
|
goto :Exit
|
||||||
|
)
|
||||||
|
|
||||||
|
:Show_Username
|
||||||
|
echo Running %basename% as %username%
|
||||||
|
|
||||||
|
:Exit
|
||||||
|
if "%~1" NEQ "qn" pause
|
||||||
|
popd
|
||||||
|
exit %code%
|
Loading…
Reference in New Issue
Block a user