-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathrun.bat
More file actions
50 lines (44 loc) · 1.52 KB
/
run.bat
File metadata and controls
50 lines (44 loc) · 1.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
@echo off
:: Prefer Windows Terminal on Windows 10/11 - Check this FIRST to minimize CMD flash
if "%WT_SESSION%"=="" (
where wt.exe >nul 2>&1
if %errorlevel% equ 0 (
:: Check if wscript.exe is available (may be disabled by policy)
where wscript.exe >nul 2>&1
if %errorlevel% equ 0 (
:: Check if launcher.vbs exists before using it
if exist "%~dp0res\launcher.vbs" (
:: Use VBScript to launch WT completely detached, avoiding ghost windows
wscript.exe "%~dp0res\launcher.vbs" "%~dp0res\console.ps1"
exit /b
)
)
)
)
title Sync-Player
cd /d "%~dp0"
:: Check for PowerShell installation
where powershell.exe >nul 2>&1
if %errorlevel% neq 0 (
echo.
echo [ERROR]: PowerShell is not installed or not in PATH!
echo PowerShell is required to run Sync-Player.
echo.
set /p "install=Press Enter to install PowerShell via winget, or Ctrl+C to exit: "
echo.
echo Installing PowerShell...
winget install --id Microsoft.PowerShell -e
if %errorlevel% neq 0 (
echo.
echo [ERROR]: Failed to install PowerShell via winget.
echo Please install it manually from: https://aka.ms/powershell
pause
exit /b 1
)
echo.
echo [SUCCESS]: PowerShell installed. Please restart this script.
pause
exit /b 0
)
:: Launch PowerShell normally if already in WT or WT is missing
powershell.exe -NoProfile -ExecutionPolicy Bypass -File "%~dp0res\console.ps1"