mirror of
https://github.com/SillyTavern/SillyTavern-Launcher.git
synced 2026-04-23 15:59:19 +00:00
Combine Troubleshooting & Support Menus, Added GPU detection, Added more compatibility stats
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -11,3 +11,6 @@ bin/*
|
||||
*.txt
|
||||
*.logs
|
||||
/bin/functions/Toolbox/Troubleshooting/telemetry/venv
|
||||
bin/functions/Toolbox/Troubleshooting/detect_vpn - OLD.bat
|
||||
bin/functions/Toolbox/Troubleshooting/home_port_check - OLD.bat
|
||||
bin/functions/Toolbox/Troubleshooting/gpu_info - CUDA DETECT IN DEV.bat
|
||||
|
||||
253
Launcher.bat
253
Launcher.bat
@@ -380,10 +380,7 @@ if %errorlevel% neq 0 (
|
||||
echo [ %green_fg_strong%OK%reset% ] Found app command: %cyan_fg_strong%conda%reset% from app: Miniconda3
|
||||
)
|
||||
|
||||
REM Run PowerShell command to retrieve VRAM size and divide by 1GB
|
||||
for /f "usebackq tokens=*" %%i in (`powershell -Command "$qwMemorySize = (Get-ItemProperty -Path 'HKLM:\SYSTEM\ControlSet001\Control\Class\{4d36e968-e325-11ce-bfc1-08002be10318}\0*' -Name HardwareInformation.qwMemorySize -ErrorAction SilentlyContinue).'HardwareInformation.qwMemorySize'; if ($null -ne $qwMemorySize -and $qwMemorySize -is [array]) { $qwMemorySize = [double]$qwMemorySize[0] } else { $qwMemorySize = [double]$qwMemorySize }; if ($null -ne $qwMemorySize) { [math]::Round($qwMemorySize/1GB) } else { 'Property not found' }"`) do (
|
||||
set "VRAM=%%i"
|
||||
)
|
||||
|
||||
|
||||
REM Check if the SillyTavern folder exists
|
||||
if not exist "%st_install_path%" (
|
||||
@@ -414,6 +411,7 @@ REM ############################################################
|
||||
:no_st_install_path
|
||||
cd /d "%st_install_path%"
|
||||
title STL [HOME]
|
||||
|
||||
cls
|
||||
|
||||
set "SSL_INFO_FILE=%~dp0\SillyTavern\certs\SillyTavernSSLInfo.txt"
|
||||
@@ -425,56 +423,76 @@ if exist "%SSL_INFO_FILE%" (
|
||||
)
|
||||
|
||||
echo %blue_fg_strong%/ Home%reset%
|
||||
echo -------------------------------------------------------------
|
||||
echo What would you like to do?
|
||||
echo 1. Update and Start SillyTavern%sslOptionSuffix%
|
||||
echo 2. Start SillyTavern%sslOptionSuffix%
|
||||
echo 3. Start SillyTavern With Remote Link%sslOptionSuffix%
|
||||
echo %cyan_fg_strong% ______________________________________________________________%reset%
|
||||
echo %cyan_fg_strong%^| What would you like to do? ^|%reset%
|
||||
echo 1. Update ^& Start SillyTavern%sslOptionSuffix%
|
||||
echo 2. Start SillyTavern%sslOptionSuffix%
|
||||
echo 3. Start SillyTavern With Remote Link%sslOptionSuffix%
|
||||
REM Check if the custom shortcut file exists and is not empty
|
||||
set "custom_name=Create Custom App Shortcut to Launch with SillyTavern" ; Initialize to default
|
||||
if exist "%~dp0bin\settings\custom-shortcut.txt" (
|
||||
set /p custom_name=<"%~dp0bin\settings\custom-shortcut.txt"
|
||||
if "!custom_name!"=="" set "custom_name=Create Custom Shortcut"
|
||||
)
|
||||
echo 4. %custom_name%
|
||||
echo 5. Update Manager
|
||||
echo 6. Toolbox
|
||||
echo 7. Support
|
||||
echo 8. More info about LLM models your GPU can run.
|
||||
echo 0. Exit
|
||||
|
||||
echo 4. %custom_name%
|
||||
echo 5. Update Manager
|
||||
echo 6. Toolbox
|
||||
echo 7. Troubleshooting ^& Support
|
||||
echo 8. More info about LLM models your GPU can run.
|
||||
echo %cyan_fg_strong% ______________________________________________________________%reset%
|
||||
echo %cyan_fg_strong%^| Menu Options: ^|%reset%
|
||||
echo 0. Exit
|
||||
|
||||
REM Get the current Git branch
|
||||
for /f %%i in ('git branch --show-current') do set current_branch=%%i
|
||||
|
||||
REM Set the counter file
|
||||
set counter_file=%log_dir%\gpu_counter.txt
|
||||
|
||||
REM Call the VPN detection script
|
||||
call "%troubleshooting_dir%\detect_vpn.bat" > "%log_dir%\vpn_status.txt"
|
||||
set /p "vpnStatus="<"%log_dir%\vpn_status.txt"
|
||||
del "%log_dir%\vpn_status.txt"
|
||||
REM Initialize or increment the counter
|
||||
if exist %counter_file% (
|
||||
for /f "delims=" %%x in (%counter_file%) do set /a counter=%%x + 1
|
||||
) else (
|
||||
set counter=1
|
||||
)
|
||||
|
||||
REM Call the home_port_check.bat script
|
||||
call "%troubleshooting_dir%\home_port_check.bat"
|
||||
REM If counter reaches 10, reset and delete the GPU info file
|
||||
if !counter! geq 10 (
|
||||
set counter=0
|
||||
del "%log_dir%\gpu_info_output.txt"
|
||||
)
|
||||
REM Save the counter back to the file
|
||||
echo !counter! > %counter_file%
|
||||
|
||||
REM Read the port status from the log file
|
||||
set "portStatus="
|
||||
for /f "delims=" %%x in (%log_dir%\port_8000_status.log) do (
|
||||
set "portStatus=%%x"
|
||||
REM Check if gpu_info_output.txt exists and call GPU detection script if not
|
||||
if not exist "%log_dir%\gpu_info_output.txt" (
|
||||
call "%troubleshooting_dir%\gpu_info.bat" > "%log_dir%\gpu_info_output.txt"
|
||||
)
|
||||
|
||||
REM Read the content of gpu_info_output.txt into gpuInfo
|
||||
if exist "%log_dir%\gpu_info_output.txt" (
|
||||
for /f "delims=" %%x in (%log_dir%\gpu_info_output.txt) do (
|
||||
set "gpuInfo=%%x"
|
||||
)
|
||||
) else (
|
||||
set "gpuInfo=GPU Info not found"
|
||||
)
|
||||
|
||||
|
||||
echo ======== VERSION STATUS =========
|
||||
echo SillyTavern branch: %cyan_fg_strong%%current_branch%%reset%
|
||||
echo SillyTavern: %update_status_st%
|
||||
echo STL Version: %stl_version%
|
||||
echo GPU VRAM: %cyan_fg_strong%%VRAM% GB%reset%
|
||||
echo Node.js: %node_version%
|
||||
echo ======== COMPATIBILITY STATUS =========
|
||||
echo %vpnStatus%
|
||||
echo %portStatus%
|
||||
echo =================================
|
||||
set "choice="
|
||||
set /p "choice=Choose Your Destiny (default is 1): "
|
||||
echo %yellow_fg_strong% ______________________________________________________________%reset%
|
||||
echo %yellow_fg_strong%^| Version ^& Compatibility Status: ^|%reset%
|
||||
echo SillyTavern - Branch: %cyan_fg_strong%!current_branch! %reset%^| Status: %cyan_fg_strong%!update_status_st!%reset%
|
||||
echo STL Version: %cyan_fg_strong%!stl_version!%reset%
|
||||
echo !gpuInfo!
|
||||
echo Node.js: %cyan_fg_strong%!node_version!%reset%
|
||||
echo %cyan_fg_strong% ______________________________________________________________%reset%
|
||||
echo %cyan_fg_strong%^| ^|%reset%
|
||||
|
||||
:: Define a variable containing a single backspace character
|
||||
for /f %%A in ('"prompt $H &echo on &for %%B in (1) do rem"') do set "BS=%%A"
|
||||
|
||||
:: Set the prompt with spaces
|
||||
set /p "choice=%BS% Choose Your Destiny (default is 1): "
|
||||
|
||||
REM Default to choice 1 if no input is provided
|
||||
if not defined choice set "choice=1"
|
||||
@@ -522,7 +540,7 @@ if "%choice%"=="1" (
|
||||
) else if "%choice%"=="6" (
|
||||
call :toolbox
|
||||
) else if "%choice%"=="7" (
|
||||
call :support
|
||||
call :troubleshooting
|
||||
) else if "%choice%"=="8" (
|
||||
set "caller=home"
|
||||
if exist "%functions_dir%\launch\info_vram.bat" (
|
||||
@@ -561,6 +579,7 @@ if "%choice%"=="1" (
|
||||
)
|
||||
goto :home
|
||||
|
||||
|
||||
REM ############################################################
|
||||
REM ############## UPDATE MANAGER - FRONTEND ###################
|
||||
REM ############################################################
|
||||
@@ -1160,8 +1179,7 @@ echo 3. App Uninstaller
|
||||
echo 4. Editor
|
||||
echo 5. Backup
|
||||
echo 6. Switch Branch
|
||||
echo 7. Troubleshooting
|
||||
echo 8. Reset Custom Shortcut
|
||||
echo 7. Reset Custom Shortcut
|
||||
echo 0. Back
|
||||
|
||||
set /p toolbox_choice=Choose Your Destiny:
|
||||
@@ -1180,8 +1198,6 @@ if "%toolbox_choice%"=="1" (
|
||||
) else if "%toolbox_choice%"=="6" (
|
||||
call :switch_branch
|
||||
) else if "%toolbox_choice%"=="7" (
|
||||
call :troubleshooting
|
||||
) else if "%toolbox_choice%"=="8" (
|
||||
call :reset_custom_shortcut
|
||||
) else if "%toolbox_choice%"=="0" (
|
||||
goto :home
|
||||
@@ -3484,7 +3500,7 @@ REM Check if the SillyTavern\certs folder exists and delete it if it does
|
||||
set "CERTS_DIR=%~dp0SillyTavern\certs"
|
||||
|
||||
if exist "%CERTS_DIR%" (
|
||||
echo %blue_fg_strong%Deleting %CERTS_DIR% ...%reset%
|
||||
echo %blue_fg_strong%Del eting %CERTS_DIR% ...%reset%
|
||||
rmdir /s /q "%CERTS_DIR%"
|
||||
if errorlevel 0 (
|
||||
echo %green_fg_strong%The SillyTavern\certs folder has been successfully deleted.%reset%
|
||||
@@ -3499,32 +3515,64 @@ goto :editor_core_utilities
|
||||
|
||||
|
||||
REM ############################################################
|
||||
REM ############## TROUBLESHOOTING - FRONTEND ##################
|
||||
REM ########## TROUBLESHOOTING & SUPPORT - FRONTEND ############
|
||||
REM ############################################################
|
||||
:troubleshooting
|
||||
title STL [TROUBLESHOOTING]
|
||||
title STL [TROUBLESHOOTING ^& SUPPORT]
|
||||
@echo off
|
||||
cls
|
||||
echo %blue_fg_strong%/ Home / Toolbox / Troubleshooting%reset%
|
||||
echo -------------------------------------------------------------
|
||||
echo What would you like to do?
|
||||
echo 1. Remove node_modules folder
|
||||
echo 2. Clear pip cache
|
||||
echo 3. Fix unresolved conflicts or unmerged files [SillyTavern]
|
||||
echo 4. Export dxdiag info
|
||||
echo 5. Find what app is using port
|
||||
echo 6. Set Onboarding Flow
|
||||
echo 0. Back
|
||||
echo %blue_fg_strong%/ Home / Toolbox / Troubleshooting ^& Support%reset%
|
||||
setlocal enabledelayedexpansion
|
||||
|
||||
REM Retrieve the PID of the current script using PowerShell TEMPORARY DISABLED UNTIL A BETTER WAY IS FOUND
|
||||
REM Call the VPN detection script
|
||||
call "%troubleshooting_dir%\detect_vpn.bat" > "%log_dir%\vpn_status.txt"
|
||||
set /p "vpnStatus="<"%log_dir%\vpn_status.txt"
|
||||
del "%log_dir%\vpn_status.txt"
|
||||
|
||||
REM for /f "delims=" %%G in ('powershell -NoProfile -Command "Get-Process | Where-Object { $_.MainWindowTitle -eq '%stl_title_pid%' } | Select-Object -ExpandProperty Id"') do (
|
||||
REM set "stl_PID=%%~G"
|
||||
REM )
|
||||
REM echo ======== INFO BOX ===============
|
||||
REM echo STL PID: %cyan_fg_strong%%stl_PID%%reset%
|
||||
REM echo =================================
|
||||
REM Call the home port check script
|
||||
call "%troubleshooting_dir%\home_port_check.bat" > "%log_dir%\port_8000_status.txt"
|
||||
set /p "portStatus="<"%log_dir%\port_8000_status.txt
|
||||
del "%log_dir%\port_8000_status.txt"
|
||||
|
||||
REM Get the current Git branch
|
||||
for /f %%i in ('git branch --show-current') do set current_branch=%%i
|
||||
|
||||
echo %yellow_fg_strong% ______________________________________________________________%reset%
|
||||
echo %yellow_fg_strong%^| Version ^& Compatibility Status: ^|%reset%
|
||||
echo SillyTavern - Branch: %cyan_fg_strong%!current_branch! %reset%^| Status: %cyan_fg_strong%!update_status_st!%reset%
|
||||
echo STL Version: %cyan_fg_strong%!stl_version!%reset%
|
||||
echo !gpuInfo!
|
||||
echo Node.js: %cyan_fg_strong%!node_version!%reset%
|
||||
echo !vpnStatus!
|
||||
echo !portStatus!
|
||||
|
||||
echo %cyan_fg_strong% ______________________________________________________________%reset%
|
||||
echo %cyan_fg_strong%^| Troubleshooting ^& Repair Options: ^|%reset%
|
||||
|
||||
echo 1. Remove node_modules folder
|
||||
echo 2. Clear pip cache
|
||||
echo 3. Fix unresolved conflicts or unmerged files [SillyTavern]
|
||||
echo 4. Export dxdiag info
|
||||
echo 5. Find what app is using port
|
||||
echo 6. Set Onboarding Flow
|
||||
echo %cyan_fg_strong% ______________________________________________________________%reset%
|
||||
echo %cyan_fg_strong%^| Support Options: ^|%reset%
|
||||
echo 7. Report an Issue
|
||||
echo 8. SillyTavern Documentation
|
||||
echo 9. Get Help on Discord
|
||||
echo %cyan_fg_strong% ______________________________________________________________%reset%
|
||||
echo %cyan_fg_strong%^| Menu Options: ^|%reset%
|
||||
echo 0. Back
|
||||
|
||||
echo %cyan_fg_strong% ______________________________________________________________%reset%
|
||||
echo %cyan_fg_strong%^| ^|%reset%
|
||||
|
||||
:: Define a variable containing a single backspace character
|
||||
for /f %%A in ('"prompt $H &echo on &for %%B in (1) do rem"') do set "BS=%%A"
|
||||
|
||||
:: Set the prompt with spaces
|
||||
set /p "troubleshooting_choice=%BS% Choose Your Destiny: "
|
||||
|
||||
set /p troubleshooting_choice=Choose Your Destiny:
|
||||
|
||||
|
||||
REM ############## TROUBLESHOOTING - BACKEND ##################
|
||||
@@ -3594,8 +3642,23 @@ if "%troubleshooting_choice%"=="1" (
|
||||
pause
|
||||
goto :troubleshooting
|
||||
)
|
||||
) else if "%troubleshooting_choice%"=="7" (
|
||||
call :issue_report
|
||||
) else if "%troubleshooting_choice%"=="8" (
|
||||
call :documentation
|
||||
) else if "%troubleshooting_choice%"=="9" (
|
||||
call :discord
|
||||
) else if "%troubleshooting_choice%"=="0" (
|
||||
goto :toolbox
|
||||
goto :home
|
||||
) else if "%choice%"=="99" (
|
||||
set "caller=home"
|
||||
if exist "%troubleshooting_dir%\find_app_port.bat" (
|
||||
call %troubleshooting_dir%\find_app_port.bat 8000
|
||||
) else (
|
||||
echo [%DATE% %TIME%] ERROR: find_app_port.bat not found in: %troubleshooting_dir% >> %logs_stl_console_path%
|
||||
echo %red_bg%[%time%]%reset% %red_fg_strong%[ERROR] find_app_port.bat not found in: %troubleshooting_dir%%reset%
|
||||
pause
|
||||
)
|
||||
) else (
|
||||
echo [%DATE% %TIME%] %log_invalidinput% >> %logs_stl_console_path%
|
||||
echo %red_bg%[%time%]%reset% %echo_invalidinput%
|
||||
@@ -3603,6 +3666,18 @@ if "%troubleshooting_choice%"=="1" (
|
||||
goto :troubleshooting
|
||||
)
|
||||
|
||||
:issue_report
|
||||
start "" "https://github.com/SillyTavern/SillyTavern-Launcher/issues/new/choose"
|
||||
goto :troubleshooting
|
||||
|
||||
:documentation
|
||||
start "" "https://docs.sillytavern.app/"
|
||||
goto :troubleshooting
|
||||
|
||||
:discord
|
||||
start "" "https://discord.gg/sillytavern"
|
||||
goto :troubleshooting
|
||||
endlocal
|
||||
|
||||
|
||||
REM ############################################################
|
||||
@@ -3732,54 +3807,6 @@ if "%backup_choice%"=="1" (
|
||||
goto :backup
|
||||
)
|
||||
|
||||
|
||||
REM ############################################################
|
||||
REM ############## SUPPORT - FRONTEND ##########################
|
||||
REM ############################################################
|
||||
:support
|
||||
title STL [SUPPORT]
|
||||
cls
|
||||
echo %blue_fg_strong%/ Home / Support%reset%
|
||||
echo -------------------------------------------------------------
|
||||
echo What would you like to do?
|
||||
echo 1. I want to report a issue
|
||||
echo 2. Documentation
|
||||
echo 3. Discord
|
||||
echo 0. Back
|
||||
|
||||
set /p support_choice=Choose Your Destiny:
|
||||
|
||||
REM ############## SUPPORT - BACKEND ##########################
|
||||
if "%support_choice%"=="1" (
|
||||
call :issue_report
|
||||
) else if "%support_choice%"=="2" (
|
||||
call :documentation
|
||||
) else if "%support_choice%"=="3" (
|
||||
call :discord
|
||||
) else if "%support_choice%"=="0" (
|
||||
goto :home
|
||||
) else (
|
||||
echo [%DATE% %TIME%] %log_invalidinput% >> %logs_stl_console_path%
|
||||
echo %red_bg%[%time%]%reset% %echo_invalidinput%
|
||||
pause
|
||||
goto :support
|
||||
)
|
||||
|
||||
:issue_report
|
||||
start "" "https://github.com/SillyTavern/SillyTavern-Launcher/issues/new/choose"
|
||||
goto :support
|
||||
|
||||
:documentation
|
||||
start "" "https://docs.sillytavern.app/"
|
||||
goto :support
|
||||
|
||||
:discord
|
||||
start "" "https://discord.gg/sillytavern"
|
||||
goto :support
|
||||
|
||||
|
||||
|
||||
|
||||
REM ############################################################
|
||||
REM ############ CREATE CUSTOM SHORTCUT - FRONTEND #############
|
||||
REM ########### ADDED BY ROLYAT / BLUEPRINTCODING ##############
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
@echo off
|
||||
REM This script detects if a VPN is active by checking network adapters using netsh and an external IP check.
|
||||
REM This script detects if a VPN is active by checking network adapters using netsh.
|
||||
|
||||
REM Initialize variables
|
||||
set "vpnDetected=false"
|
||||
@@ -75,34 +75,6 @@ for /f "skip=3 tokens=1,2,3,4,* delims= " %%a in ('netsh interface show interfac
|
||||
)
|
||||
)
|
||||
|
||||
REM Check external IP for VPN status if no VPN detected yet
|
||||
if "%vpnDetected%"=="false" (
|
||||
echo No VPN adapter detected locally, checking external IP... >> "%logfile%"
|
||||
|
||||
REM Get the external IP address
|
||||
for /f "delims=" %%i in ('curl -s --max-time 5 https://api.ipify.org') do set "externalIP=%%i"
|
||||
echo External IP: !externalIP! >> "%logfile%"
|
||||
|
||||
REM Check the external IP for VPN status using proxycheck.io
|
||||
set "apiResponse="
|
||||
for /f "delims=" %%i in ('curl -s --max-time 5 "https://proxycheck.io/v2/!externalIP!?vpn=2"') do set "apiResponse=!apiResponse! %%i"
|
||||
echo ProxyCheck API Response: !apiResponse! >> "%logfile%"
|
||||
|
||||
REM Write the API response to a temporary file
|
||||
echo !apiResponse! > "%log_dir%\vpn_check.json"
|
||||
|
||||
REM Parse the JSON response to find the proxy value
|
||||
for /f "delims=" %%a in ('type %log_dir%\vpn_check.json') do (
|
||||
set "line=%%a"
|
||||
if "!line!"=="proxy:" (
|
||||
set "vpnDetected=true"
|
||||
echo VPN detected based on external IP check. >> "%logfile%"
|
||||
goto :vpn_found
|
||||
)
|
||||
)
|
||||
echo No VPN detected based on external IP check. >> "%logfile%"
|
||||
)
|
||||
|
||||
:vpn_found
|
||||
if "%vpnDetected%"=="true" (
|
||||
echo VPN Status: %yellow_fg_strong%VPN detected. Local IP access and NodeJS install issues possible.%reset%
|
||||
|
||||
@@ -4,7 +4,12 @@ REM Function to find and display the application using the specified port
|
||||
:find_app_port
|
||||
cls
|
||||
setlocal EnableDelayedExpansion
|
||||
set /p port_choice="(0 to cancel)Insert port number: "
|
||||
|
||||
if "%~1"=="" (
|
||||
set /p port_choice="(0 to cancel)Insert port number: "
|
||||
) else (
|
||||
set "port_choice=%~1"
|
||||
)
|
||||
|
||||
if "%port_choice%"=="0" goto :troubleshooting
|
||||
|
||||
@@ -72,5 +77,3 @@ if "%caller%"=="home" (
|
||||
) else (
|
||||
exit /b 0
|
||||
)
|
||||
|
||||
|
||||
|
||||
38
bin/functions/Toolbox/Troubleshooting/gpu_info.bat
Normal file
38
bin/functions/Toolbox/Troubleshooting/gpu_info.bat
Normal file
@@ -0,0 +1,38 @@
|
||||
@echo off
|
||||
|
||||
REM Initialize variables
|
||||
set "GPU_name=Unknown"
|
||||
set "VRAM=Unknown"
|
||||
set "GPU_TYPE=Unknown"
|
||||
set "primary_gpu_found=false"
|
||||
set "gpuDetected=false"
|
||||
setlocal enabledelayedexpansion
|
||||
|
||||
REM Detect GPU name using wmic based on AdapterRAM size
|
||||
for /f "tokens=2 delims==" %%f in ('wmic path Win32_VideoController where "AdapterRAM > 0" get name /value ^| find "="') do (
|
||||
set "current_gpu=%%f"
|
||||
if /i "!current_gpu!" neq "Microsoft Basic Display Adapter" (
|
||||
set "GPU_name=!current_gpu!"
|
||||
set "primary_gpu_found=true"
|
||||
goto :vram_check
|
||||
) else if "!primary_gpu_found!" equ "false" (
|
||||
set "GPU_name=!current_gpu!"
|
||||
goto :vram_check
|
||||
)
|
||||
)
|
||||
|
||||
:vram_check
|
||||
REM Run PowerShell command to retrieve VRAM size and divide by 1GB
|
||||
for /f "usebackq tokens=*" %%i in (`powershell -Command "$qwMemorySize = (Get-ItemProperty -Path 'HKLM:\SYSTEM\ControlSet001\Control\Class\{4d36e968-e325-11ce-bfc1-08002be10318}\0*' -Name HardwareInformation.qwMemorySize -ErrorAction SilentlyContinue).'HardwareInformation.qwMemorySize'; if ($null -ne $qwMemorySize -and $qwMemorySize -is [array]) { $qwMemorySize = [double]$qwMemorySize[0] } else { $qwMemorySize = [double]$qwMemorySize }; if ($null -ne $qwMemorySize) { [math]::Round($qwMemorySize/1GB) } else { 'Property not found' }"`) do (
|
||||
set "VRAM=%%i"
|
||||
)
|
||||
set "gpuDetected=true"
|
||||
|
||||
:gpu_found
|
||||
if "%gpuDetected%"=="true" (
|
||||
echo GPU: %cyan_fg_strong%%GPU_name%%reset% - VRAM: %cyan_fg_strong%%VRAM%%reset% GB
|
||||
) else (
|
||||
echo GPU Info not found
|
||||
)
|
||||
|
||||
endlocal
|
||||
@@ -1,7 +1,8 @@
|
||||
@echo off
|
||||
setlocal enabledelayedexpansion
|
||||
|
||||
REM Set the log file
|
||||
set "log_file=%log_dir%\port_8000_status.log"
|
||||
set "log_file=%log_dir%\port_8000_status.txt"
|
||||
|
||||
REM Function to check the application using port 8000
|
||||
:check_port_8000
|
||||
@@ -13,7 +14,6 @@ set "pid="
|
||||
set "app_name="
|
||||
set "PAGE_TITLE="
|
||||
|
||||
echo Searching for application using port: !port_choice!... > "%log_file%"
|
||||
for /f "tokens=5" %%a in ('netstat -aon ^| findstr /r "\<!port_choice!\>"') do (
|
||||
set "pid=%%a"
|
||||
)
|
||||
@@ -22,26 +22,26 @@ if defined pid (
|
||||
if "!pid!" neq "0" (
|
||||
for /f "tokens=2*" %%b in ('tasklist /fi "PID eq !pid!" /fo list ^| find "Image Name"') do (
|
||||
set "app_name=%%c"
|
||||
echo Application Name: !app_name! >> "%log_file%"
|
||||
echo PID of Port !port_choice!: !pid! >> "%log_file%"
|
||||
|
||||
REM Fetch the page title for the specified port
|
||||
call :fetch_page_title !port_choice!
|
||||
if "!PAGE_TITLE!"=="The server returned an invalid or unrecognized response" (
|
||||
echo Port Status: %red_fg_strong%8000 in Use: App title not found, may be using HTTPS%reset% >> "%log_file%"
|
||||
set "portStatus=Port Status: %red_fg_strong%8000 in Use: App title not found, may be using HTTPS%reset%"
|
||||
) else if defined PAGE_TITLE (
|
||||
echo Port Status: %red_fg_strong%8000 in Use: !PAGE_TITLE!%reset% >> "%log_file%"
|
||||
set "portStatus=Port Status: %red_fg_strong%8000 in Use: !PAGE_TITLE!%reset%"
|
||||
) else (
|
||||
echo Port Status: %red_fg_strong%8000 in Use: !app_name!%reset% >> "%log_file%"
|
||||
set "portStatus=Port Status: %red_fg_strong%8000 in Use: !app_name!%reset%"
|
||||
)
|
||||
)
|
||||
) else (
|
||||
echo Port Status: %green_fg_strong%8000 not in use%reset% >> "%log_file%"
|
||||
set "portStatus=Port 8000 not in use"
|
||||
)
|
||||
) else (
|
||||
echo Port Status: %green_fg_strong%8000 not in use%reset% >> "%log_file%"
|
||||
set "portStatus=Port 8000 not in use"
|
||||
)
|
||||
|
||||
echo !portStatus!
|
||||
|
||||
endlocal
|
||||
goto :EOF
|
||||
|
||||
@@ -67,7 +67,7 @@ if "!PAGE_TITLE!"=="The server returned an invalid or unrecognized response" (
|
||||
|
||||
REM Log if PAGE_TITLE is not retrieved
|
||||
if not defined PAGE_TITLE (
|
||||
echo Could not retrieve page title from URL: %URL% >> "%log_file%"
|
||||
set "PAGE_TITLE=Could not find App Title"
|
||||
)
|
||||
|
||||
endlocal & set "PAGE_TITLE=%PAGE_TITLE%"
|
||||
@@ -76,5 +76,4 @@ goto :EOF
|
||||
REM Call the function to check port 8000
|
||||
call :check_port_8000
|
||||
|
||||
echo Port status has been logged to %log_file%.
|
||||
pause
|
||||
|
||||
Reference in New Issue
Block a user