Detect run by doucle-click

pull/1055/head
bmaltais 2023-06-23 20:55:52 -04:00
parent 3fdb33384e
commit 41fbcdcaaf
2 changed files with 18 additions and 3 deletions

12
gui.bat
View File

@ -1,4 +1,5 @@
@echo off
:: Deactivate the virtual environment
call .\venv\Scripts\deactivate.bat
@ -14,5 +15,12 @@ python.exe .\setup\validate_requirements.py
:: If the exit code is 0, run the kohya_gui.py script with the command-line arguments
if %errorlevel% equ 0 (
cmd /k python.exe kohya_gui.py %*
)
REM Check if the batch was started via double-click
IF /i "%comspec% /c %~0 " equ "%cmdcmdline:"=%" (
REM echo This script was started by double clicking.
cmd /k python.exe kohya_gui.py %*
) ELSE (
REM echo This script was started from a command prompt.
python.exe kohya_gui.py %*
)
)

View File

@ -24,7 +24,14 @@ python .\setup\check_local_modules.py
call .\venv\Scripts\activate.bat
cmd /k python .\setup\setup_windows.py
REM Check if the batch was started via double-click
IF /i "%comspec% /c %~0 " equ "%cmdcmdline:"=%" (
REM echo This script was started by double clicking.
cmd /k python .\setup\setup_windows.py
) ELSE (
REM echo This script was started from a command prompt.
python .\setup\setup_windows.py
)
:: Deactivate the virtual environment
call .\venv\Scripts\deactivate.bat