mirror of
https://github.com/Flowseal/zapret-discord-youtube.git
synced 2025-02-22 09:06:08 -08:00
118 lines
2.9 KiB
Batchfile
118 lines
2.9 KiB
Batchfile
@echo off
|
|
setlocal EnableDelayedExpansion
|
|
chcp 65001 >nul
|
|
:: 65001 - UTF-8
|
|
|
|
set "arg=%1"
|
|
if "%arg%" == "admin" (
|
|
echo Restarted with admin rights
|
|
) else (
|
|
powershell -Command "Start-Process 'cmd.exe' -ArgumentList '/k \"\"%~f0\" admin\"' -Verb RunAs"
|
|
exit /b
|
|
)
|
|
|
|
cd /d "%~dp0"
|
|
call check_updates.bat soft
|
|
echo:
|
|
|
|
set BIN_PATH=%~dp0bin\
|
|
|
|
:: Searching for .bat files in current folder, except files that start with "service"
|
|
set "count=0"
|
|
for %%f in (*.bat) do (
|
|
set "filename=%%~nxf"
|
|
if /i not "!filename:~0,7!"=="service" if /i not "!filename:~0,13!"=="check_updates" (
|
|
set /a count+=1
|
|
echo !count!. %%f
|
|
set "file!count!=%%f"
|
|
)
|
|
)
|
|
|
|
:: Choosing file
|
|
set "choice="
|
|
set /p "choice=Input file index (number): "
|
|
|
|
if "!choice!"=="" goto :eof
|
|
|
|
set "selectedFile=!file%choice%!"
|
|
if not defined selectedFile (
|
|
echo Wrong choice, exiting..
|
|
pause
|
|
goto :eof
|
|
)
|
|
|
|
:: Parsing args (mergeargs: 2=start param|1=params args|0=default)
|
|
set "args="
|
|
set "capture=0"
|
|
set "mergeargs=0"
|
|
set QUOTE="
|
|
|
|
for /f "tokens=*" %%a in ('type "!selectedFile!"') do (
|
|
set "line=%%a"
|
|
|
|
echo !line! | findstr /i "%BIN%winws.exe" >nul
|
|
if not errorlevel 1 (
|
|
set "capture=1"
|
|
)
|
|
|
|
if !capture!==1 (
|
|
if not defined args (
|
|
set "line=!line:*%BIN%winws.exe"=!"
|
|
)
|
|
|
|
set "temp_args="
|
|
for %%i in (!line!) do (
|
|
set "arg=%%i"
|
|
|
|
if not "!arg!"=="^" (
|
|
if "!arg:~0,2!" EQU "--" if not !mergeargs!==0 (
|
|
set "mergeargs=0"
|
|
)
|
|
|
|
if "!arg:~0,1!" EQU "!QUOTE!" (
|
|
set "arg=!arg:~1,-1!"
|
|
|
|
echo !arg! | findstr ":" >nul
|
|
if !errorlevel!==0 (
|
|
set "arg=\!QUOTE!!arg!\!QUOTE!"
|
|
) else if "!arg:~0,1!"=="@" (
|
|
set "arg=\!QUOTE!@%~dp0!arg:~1!\!QUOTE!"
|
|
) else if "!arg:~0,5!"=="%%BIN%%" (
|
|
set "arg=\!QUOTE!!BIN_PATH!!arg:~5!\!QUOTE!"
|
|
) else (
|
|
set "arg=\!QUOTE!%~dp0!arg!\!QUOTE!"
|
|
)
|
|
)
|
|
|
|
if !mergeargs!==1 (
|
|
set "temp_args=!temp_args!,!arg!"
|
|
) else (
|
|
set "temp_args=!temp_args! !arg!"
|
|
)
|
|
|
|
if "!arg:~0,2!" EQU "--" (
|
|
set "mergeargs=2"
|
|
) else if !mergeargs!==2 (
|
|
set "mergeargs=1"
|
|
)
|
|
)
|
|
)
|
|
|
|
if not "!temp_args!"=="" (
|
|
set "args=!args! !temp_args!"
|
|
)
|
|
)
|
|
)
|
|
|
|
:: Creating service with parsed args
|
|
set ARGS=%args%
|
|
echo Final args: !ARGS!
|
|
|
|
set SRVCNAME=zapret
|
|
|
|
net stop %SRVCNAME%
|
|
sc delete %SRVCNAME%
|
|
sc create %SRVCNAME% binPath= "\"%BIN_PATH%winws.exe\" %ARGS%" DisplayName= "zapret" start= auto
|
|
sc description %SRVCNAME% "zapret DPI bypass software"
|
|
sc start %SRVCNAME%
|