New Windows batch files by @Tremerix
This commit is contained in:
parent
985aadacbc
commit
9e3c501bfa
|
@ -1,23 +1,35 @@
|
||||||
@ECHO OFF
|
@set @_cmd=1 /*
|
||||||
|
@echo off
|
||||||
|
setlocal EnableExtensions
|
||||||
|
title DNSCrypt-Proxy
|
||||||
|
|
||||||
SFC 2>&1 | FIND /i "/SCANNOW" >NUL
|
whoami /groups | find "S-1-16-12288" >nul && goto :admin
|
||||||
IF %ERRORLEVEL% NEQ 0 GOTO ELEVATE
|
if "%~1"=="RunAsAdmin" goto :error
|
||||||
GOTO ADMINTASKS
|
|
||||||
|
|
||||||
:ELEVATE
|
echo Requesting privileges elevation for managing the dnscrypt-proxy service . . .
|
||||||
ECHO Elevated privileges are temporarily required, just to register or remove the dnscrypt-proxy service
|
cscript /nologo /e:javascript "%~f0" || goto :error
|
||||||
CD /d %~dp0
|
exit /b
|
||||||
MSHTA "javascript: var shell = new ActiveXObject('shell.application'); shell.ShellExecute('%~nx0', '', '', 'runas', 1); close();"
|
|
||||||
EXIT
|
|
||||||
|
|
||||||
:ADMINTASKS
|
:error
|
||||||
|
echo.
|
||||||
|
echo Error: Administrator privileges elevation failed,
|
||||||
|
echo please manually run this script as administrator.
|
||||||
|
echo.
|
||||||
|
goto :end
|
||||||
|
|
||||||
CD /d %~dp0
|
:admin
|
||||||
|
pushd "%~dp0"
|
||||||
|
dnscrypt-proxy.exe -service install
|
||||||
|
dnscrypt-proxy.exe -service start
|
||||||
|
popd
|
||||||
|
echo.
|
||||||
|
echo Thank you for using DNSCrypt-Proxy!
|
||||||
|
|
||||||
CMD.EXE /c "dnscrypt-proxy.exe -service install"
|
:end
|
||||||
CMD.EXE /c "dnscrypt-proxy.exe -service start"
|
set /p =Press [Enter] to exit . . .
|
||||||
|
exit /b */
|
||||||
|
|
||||||
ECHO.
|
// JScript, restart batch script as administrator
|
||||||
SET /P _=Thank you for using dnscrypt-proxy! Hit [RETURN] to finish
|
var objShell = WScript.CreateObject('Shell.Application');
|
||||||
|
var ComSpec = WScript.CreateObject('WScript.Shell').ExpandEnvironmentStrings('%ComSpec%');
|
||||||
EXIT
|
objShell.ShellExecute(ComSpec, '/c ""' + WScript.ScriptFullName + '" RunAsAdmin"', '', 'runas', 1);
|
||||||
|
|
|
@ -1,23 +1,35 @@
|
||||||
@ECHO OFF
|
@set @_cmd=1 /*
|
||||||
|
@echo off
|
||||||
|
setlocal EnableExtensions
|
||||||
|
title DNSCrypt-Proxy
|
||||||
|
|
||||||
SFC 2>&1 | FIND /i "/SCANNOW" >NUL
|
whoami /groups | find "S-1-16-12288" >nul && goto :admin
|
||||||
IF %ERRORLEVEL% NEQ 0 GOTO ELEVATE
|
if "%~1"=="RunAsAdmin" goto :error
|
||||||
GOTO ADMINTASKS
|
|
||||||
|
|
||||||
:ELEVATE
|
echo Requesting privileges elevation for managing the dnscrypt-proxy service . . .
|
||||||
ECHO Elevated privileges are temporarily required, just to register or remove the dnscrypt-proxy service
|
cscript /nologo /e:javascript "%~f0" || goto :error
|
||||||
CD /d %~dp0
|
exit /b
|
||||||
MSHTA "javascript: var shell = new ActiveXObject('shell.application'); shell.ShellExecute('%~nx0', '', '', 'runas', 1); close();"
|
|
||||||
EXIT
|
|
||||||
|
|
||||||
:ADMINTASKS
|
:error
|
||||||
|
echo.
|
||||||
|
echo Error: Administrator privileges elevation failed,
|
||||||
|
echo please manually run this script as administrator.
|
||||||
|
echo.
|
||||||
|
goto :end
|
||||||
|
|
||||||
CD /d %~dp0
|
:admin
|
||||||
|
pushd "%~dp0"
|
||||||
|
dnscrypt-proxy.exe -service stop
|
||||||
|
dnscrypt-proxy.exe -service start
|
||||||
|
popd
|
||||||
|
echo.
|
||||||
|
echo Thank you for using DNSCrypt-Proxy!
|
||||||
|
|
||||||
CMD.EXE /c "dnscrypt-proxy.exe -service stop"
|
:end
|
||||||
CMD.EXE /c "dnscrypt-proxy.exe -service start"
|
set /p =Press [Enter] to exit . . .
|
||||||
|
exit /b */
|
||||||
|
|
||||||
ECHO.
|
// JScript, restart batch script as administrator
|
||||||
SET /P _=Thank you for using dnscrypt-proxy! Hit [RETURN] to finish
|
var objShell = WScript.CreateObject('Shell.Application');
|
||||||
|
var ComSpec = WScript.CreateObject('WScript.Shell').ExpandEnvironmentStrings('%ComSpec%');
|
||||||
EXIT
|
objShell.ShellExecute(ComSpec, '/c ""' + WScript.ScriptFullName + '" RunAsAdmin"', '', 'runas', 1);
|
||||||
|
|
|
@ -1,23 +1,35 @@
|
||||||
@ECHO OFF
|
@set @_cmd=1 /*
|
||||||
|
@echo off
|
||||||
|
setlocal EnableExtensions
|
||||||
|
title DNSCrypt-Proxy
|
||||||
|
|
||||||
SFC 2>&1 | FIND /i "/SCANNOW" >NUL
|
whoami /groups | find "S-1-16-12288" >nul && goto :admin
|
||||||
IF %ERRORLEVEL% NEQ 0 GOTO ELEVATE
|
if "%~1"=="RunAsAdmin" goto :error
|
||||||
GOTO ADMINTASKS
|
|
||||||
|
|
||||||
:ELEVATE
|
echo Requesting privileges elevation for managing the dnscrypt-proxy service . . .
|
||||||
ECHO Elevated privileges are temporarily required, just to register or remove the dnscrypt-proxy service
|
cscript /nologo /e:javascript "%~f0" || goto :error
|
||||||
CD /d %~dp0
|
exit /b
|
||||||
MSHTA "javascript: var shell = new ActiveXObject('shell.application'); shell.ShellExecute('%~nx0', '', '', 'runas', 1); close();"
|
|
||||||
EXIT
|
|
||||||
|
|
||||||
:ADMINTASKS
|
:error
|
||||||
|
echo.
|
||||||
|
echo Error: Administrator privileges elevation failed,
|
||||||
|
echo please manually run this script as administrator.
|
||||||
|
echo.
|
||||||
|
goto :end
|
||||||
|
|
||||||
CD /d %~dp0
|
:admin
|
||||||
|
pushd "%~dp0"
|
||||||
|
dnscrypt-proxy.exe -service stop
|
||||||
|
dnscrypt-proxy.exe -service uninstall
|
||||||
|
popd
|
||||||
|
echo.
|
||||||
|
echo Thank you for using DNSCrypt-Proxy!
|
||||||
|
|
||||||
CMD.EXE /c ".\dnscrypt-proxy.exe -service stop"
|
:end
|
||||||
CMD.EXE /c ".\dnscrypt-proxy.exe -service uninstall"
|
set /p =Press [Enter] to exit . . .
|
||||||
|
exit /b */
|
||||||
|
|
||||||
ECHO.
|
// JScript, restart batch script as administrator
|
||||||
SET /P _=Thank you for using dnscrypt-proxy! Hit [RETURN] to finish
|
var objShell = WScript.CreateObject('Shell.Application');
|
||||||
|
var ComSpec = WScript.CreateObject('WScript.Shell').ExpandEnvironmentStrings('%ComSpec%');
|
||||||
EXIT
|
objShell.ShellExecute(ComSpec, '/c ""' + WScript.ScriptFullName + '" RunAsAdmin"', '', 'runas', 1);
|
||||||
|
|
Loading…
Reference in New Issue