diff --git a/gui.bat b/gui.bat index 7b2968a..43b7d92 100644 --- a/gui.bat +++ b/gui.bat @@ -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 %* -) \ No newline at end of file + 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 %* + ) +) diff --git a/setup.bat b/setup.bat index a4658a8..dc68cbd 100644 --- a/setup.bat +++ b/setup.bat @@ -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 \ No newline at end of file