Disable PowerShell script profiles (#9030)

This commit is contained in:
Matvey Beloded
2026-01-12 23:43:35 +07:00
committed by GitHub
parent c4516f3f74
commit f5e5a858e7

View File

@@ -37,7 +37,7 @@ if "%1"=="admin" (
call :check_command powershell call :check_command powershell
echo Requesting admin rights... echo Requesting admin rights...
powershell -Command "Start-Process 'cmd.exe' -ArgumentList '/c \"\"%~f0\" admin\"' -Verb RunAs" powershell -NoProfile -Command "Start-Process 'cmd.exe' -ArgumentList '/c \"\"%~f0\" admin\"' -Verb RunAs"
exit exit
) )
@@ -338,7 +338,7 @@ set "GITHUB_RELEASE_URL=https://github.com/Flowseal/zapret-discord-youtube/relea
set "GITHUB_DOWNLOAD_URL=https://github.com/Flowseal/zapret-discord-youtube/releases/latest/download/zapret-discord-youtube-" set "GITHUB_DOWNLOAD_URL=https://github.com/Flowseal/zapret-discord-youtube/releases/latest/download/zapret-discord-youtube-"
:: Get the latest version from GitHub :: Get the latest version from GitHub
for /f "delims=" %%A in ('powershell -command "(Invoke-WebRequest -Uri \"%GITHUB_VERSION_URL%\" -Headers @{\"Cache-Control\"=\"no-cache\"} -UseBasicParsing -TimeoutSec 5).Content.Trim()" 2^>nul') do set "GITHUB_VERSION=%%A" for /f "delims=" %%A in ('powershell -NoProfile -Command "(Invoke-WebRequest -Uri \"%GITHUB_VERSION_URL%\" -Headers @{\"Cache-Control\"=\"no-cache\"} -UseBasicParsing -TimeoutSec 5).Content.Trim()" 2^>nul') do set "GITHUB_VERSION=%%A"
:: Error handling :: Error handling
if not defined GITHUB_VERSION ( if not defined GITHUB_VERSION (
@@ -513,7 +513,7 @@ echo:
:: DNS :: DNS
set "dohfound=0" set "dohfound=0"
for /f "delims=" %%a in ('powershell -Command "Get-ChildItem -Recurse -Path 'HKLM:System\CurrentControlSet\Services\Dnscache\InterfaceSpecificParameters\' | Get-ItemProperty | Where-Object { $_.DohFlags -gt 0 } | Measure-Object | Select-Object -ExpandProperty Count"') do ( for /f "delims=" %%a in ('powershell -NoProfile -Command "Get-ChildItem -Recurse -Path 'HKLM:System\CurrentControlSet\Services\Dnscache\InterfaceSpecificParameters\' | Get-ItemProperty | Where-Object { $_.DohFlags -gt 0 } | Measure-Object | Select-Object -ExpandProperty Count"') do (
if %%a gtr 0 ( if %%a gtr 0 (
set "dohfound=1" set "dohfound=1"
) )
@@ -810,7 +810,7 @@ echo Updating ipset-all...
if exist "%SystemRoot%\System32\curl.exe" ( if exist "%SystemRoot%\System32\curl.exe" (
curl -L -o "%listFile%" "%url%" curl -L -o "%listFile%" "%url%"
) else ( ) else (
powershell -Command ^ powershell -NoProfile -Command ^
"$url = '%url%';" ^ "$url = '%url%';" ^
"$out = '%listFile%';" ^ "$out = '%listFile%';" ^
"$dir = Split-Path -Parent $out;" ^ "$dir = Split-Path -Parent $out;" ^
@@ -840,7 +840,7 @@ echo Checking hosts file...
if exist "%SystemRoot%\System32\curl.exe" ( if exist "%SystemRoot%\System32\curl.exe" (
curl -L -s -o "%tempFile%" "%hostsUrl%" curl -L -s -o "%tempFile%" "%hostsUrl%"
) else ( ) else (
powershell -Command ^ powershell -NoProfile -Command ^
"$url = '%hostsUrl%';" ^ "$url = '%hostsUrl%';" ^
"$out = '%tempFile%';" ^ "$out = '%tempFile%';" ^
"$res = Invoke-WebRequest -Uri $url -TimeoutSec 10 -UseBasicParsing;" ^ "$res = Invoke-WebRequest -Uri $url -TimeoutSec 10 -UseBasicParsing;" ^
@@ -917,15 +917,15 @@ goto menu
:: Utility functions :: Utility functions
:PrintGreen :PrintGreen
powershell -Command "Write-Host \"%~1\" -ForegroundColor Green" powershell -NoProfile -Command "Write-Host \"%~1\" -ForegroundColor Green"
exit /b exit /b
:PrintRed :PrintRed
powershell -Command "Write-Host \"%~1\" -ForegroundColor Red" powershell -NoProfile -Command "Write-Host \"%~1\" -ForegroundColor Red"
exit /b exit /b
:PrintYellow :PrintYellow
powershell -Command "Write-Host \"%~1\" -ForegroundColor Yellow" powershell -NoProfile -Command "Write-Host \"%~1\" -ForegroundColor Yellow"
exit /b exit /b
:check_command :check_command