2018-04-27 00:19:26 +02:00
|
|
|
@set @_cmd=1 /*
|
|
|
|
@echo off
|
|
|
|
setlocal EnableExtensions
|
|
|
|
title DNSCrypt-Proxy
|
2018-04-10 20:04:03 +02:00
|
|
|
|
2018-04-27 00:19:26 +02:00
|
|
|
whoami /groups | find "S-1-16-12288" >nul && goto :admin
|
|
|
|
if "%~1"=="RunAsAdmin" goto :error
|
2018-01-25 14:15:28 +01:00
|
|
|
|
2018-04-27 00:19:26 +02:00
|
|
|
echo Requesting privileges elevation for managing the dnscrypt-proxy service . . .
|
|
|
|
cscript /nologo /e:javascript "%~f0" || goto :error
|
|
|
|
exit /b
|
2018-01-25 14:15:28 +01:00
|
|
|
|
2018-04-27 00:19:26 +02:00
|
|
|
:error
|
|
|
|
echo.
|
|
|
|
echo Error: Administrator privileges elevation failed,
|
|
|
|
echo please manually run this script as administrator.
|
|
|
|
echo.
|
|
|
|
goto :end
|
2018-01-25 14:15:28 +01:00
|
|
|
|
2018-04-27 00:19:26 +02:00
|
|
|
:admin
|
|
|
|
pushd "%~dp0"
|
|
|
|
dnscrypt-proxy.exe -service stop
|
|
|
|
dnscrypt-proxy.exe -service uninstall
|
|
|
|
popd
|
|
|
|
echo.
|
|
|
|
echo Thank you for using DNSCrypt-Proxy!
|
2018-04-16 02:30:23 +02:00
|
|
|
|
2018-04-27 00:19:26 +02:00
|
|
|
:end
|
|
|
|
set /p =Press [Enter] to exit . . .
|
|
|
|
exit /b */
|
2018-01-25 14:15:28 +01:00
|
|
|
|
2018-04-27 00:19:26 +02:00
|
|
|
// JScript, restart batch script as administrator
|
|
|
|
var objShell = WScript.CreateObject('Shell.Application');
|
|
|
|
var ComSpec = WScript.CreateObject('WScript.Shell').ExpandEnvironmentStrings('%ComSpec%');
|
|
|
|
objShell.ShellExecute(ComSpec, '/c ""' + WScript.ScriptFullName + '" RunAsAdmin"', '', 'runas', 1);
|