1
0
mirror of https://github.com/DNSCrypt/dnscrypt-proxy.git synced 2024-12-11 22:35:40 +01:00
dnscrypt-proxy/windows/service-uninstall.bat
Aleksandr Sergeev a389067d29 Replace “find” with “findstr” in batches (#764)
* Update service-install.bat

* Update service-restart.bat

* Update service-uninstall.bat
2019-03-21 14:23:01 +01:00

36 lines
993 B
Batchfile
Executable File

@set @_cmd=1 /*
@echo off
setlocal EnableExtensions
title DNSCrypt-Proxy
whoami /groups | findstr "S-1-16-12288" >nul && goto :admin
if "%~1"=="RunAsAdmin" goto :error
echo Requesting privileges elevation for managing the dnscrypt-proxy service . . .
cscript /nologo /e:javascript "%~f0" || goto :error
exit /b
:error
echo.
echo Error: Administrator privileges elevation failed,
echo please manually run this script as administrator.
echo.
goto :end
:admin
pushd "%~dp0"
dnscrypt-proxy.exe -service stop
dnscrypt-proxy.exe -service uninstall
popd
echo.
echo Thank you for using DNSCrypt-Proxy!
:end
set /p =Press [Enter] to exit . . .
exit /b */
// 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);