2025-05-22 03:57:40 +08:00
|
|
|
@echo off
|
2026-02-01 01:41:12 +01:00
|
|
|
setlocal EnableDelayedExpansion
|
|
|
|
|
|
2025-05-22 03:57:40 +08:00
|
|
|
:: Set Windows Terminal installation paths. (Default and Scoop installation)
|
|
|
|
|
set "wtDefaultPath=%LOCALAPPDATA%\Microsoft\WindowsApps\wt.exe"
|
|
|
|
|
set "wtScoopPath=%USERPROFILE%\scoop\apps\windows-terminal\current\wt.exe"
|
2026-02-01 01:41:12 +01:00
|
|
|
set "logFile=%~dp0Win11Debloat.log"
|
2025-05-22 03:57:40 +08:00
|
|
|
|
2026-02-01 01:41:12 +01:00
|
|
|
:: Determine which terminal exists
|
2025-05-22 03:57:40 +08:00
|
|
|
if exist "%wtDefaultPath%" (
|
2026-02-01 01:41:12 +01:00
|
|
|
set "wtPath=%wtDefaultPath%"
|
2025-05-22 03:57:40 +08:00
|
|
|
) else if exist "%wtScoopPath%" (
|
2026-02-01 01:41:12 +01:00
|
|
|
set "wtPath=%wtScoopPath%"
|
|
|
|
|
) else (
|
|
|
|
|
echo Windows Terminal not found. Using default PowerShell instead.
|
|
|
|
|
set "wtPath="
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
:: Launch script
|
|
|
|
|
if defined wtPath (
|
|
|
|
|
call :Log Launching Win11Debloat.ps1 with Windows Terminal...
|
|
|
|
|
PowerShell -Command "Start-Process -FilePath '%wtPath%' -ArgumentList 'PowerShell -NoProfile -ExecutionPolicy Bypass -File ""%~dp0Win11Debloat.ps1""' -Verb RunAs" >> "%logFile%" || call :Error "PowerShell command failed"
|
|
|
|
|
call :Log Script execution passed successfully to Win11Debloat.ps1
|
2025-05-22 03:57:40 +08:00
|
|
|
) else (
|
2026-02-01 01:41:12 +01:00
|
|
|
echo Windows Terminal not found. Using default PowerShell instead...
|
|
|
|
|
call :Log Windows Terminal not found. Using default PowerShell to launch Win11Debloat.ps1...
|
|
|
|
|
PowerShell -ExecutionPolicy Bypass -Command "& {Start-Process PowerShell -ArgumentList '-NoProfile -ExecutionPolicy Bypass -File ""%~dp0Win11Debloat.ps1""' -Verb RunAs}" >> "%logFile%" || call :Error "PowerShell command failed"
|
|
|
|
|
call :Log Script execution passed successfully to Win11Debloat.ps1
|
2025-05-22 03:57:40 +08:00
|
|
|
)
|
2026-02-01 01:41:12 +01:00
|
|
|
|
|
|
|
|
echo.
|
|
|
|
|
echo If you need further assistance, please open an issue at:
|
|
|
|
|
echo https://github.com/Raphire/Win11Debloat/issues
|
|
|
|
|
goto :EOF
|
|
|
|
|
|
|
|
|
|
:: Logging Function
|
|
|
|
|
:Log
|
|
|
|
|
echo %* >> "%logFile%"
|
|
|
|
|
goto :EOF
|
|
|
|
|
:: Error Handler
|
|
|
|
|
:Error
|
|
|
|
|
echo ERROR: %*
|
|
|
|
|
echo Logged in %logFile%
|
|
|
|
|
pause
|
|
|
|
|
goto :EOF
|