service-uninstall.bat 990 Bytes
Newer Older
1 2 3 4
@set @_cmd=1 /*
@echo off
setlocal EnableExtensions
title DNSCrypt-Proxy
5

6 7
whoami /groups | find "S-1-16-12288" >nul && goto :admin
if "%~1"=="RunAsAdmin" goto :error
8

9 10 11
echo Requesting privileges elevation for managing the dnscrypt-proxy service . . .
cscript /nologo /e:javascript "%~f0" || goto :error
exit /b
12

13 14 15 16 17 18
:error
echo.
echo Error: Administrator privileges elevation failed,
echo        please manually run this script as administrator.
echo.
goto :end
19

20 21 22 23 24 25 26
:admin
pushd "%~dp0"
dnscrypt-proxy.exe -service stop
dnscrypt-proxy.exe -service uninstall
popd
echo.
echo Thank you for using DNSCrypt-Proxy!
27

28 29 30
:end
set /p =Press [Enter] to exit . . .
exit /b */
31

32 33 34 35
// 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);