-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpython to exe.bat
More file actions
55 lines (47 loc) · 1.35 KB
/
python to exe.bat
File metadata and controls
55 lines (47 loc) · 1.35 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
51
52
53
54
55
@echo off
REM ======================================================
REM Build Script for Directory Tree Generator
REM Packages Python script to Windows executable (.exe)
REM ======================================================
setlocal
REM Set Python script name
set SCRIPT_NAME=generate_dir_tree.py
REM Set output directory
set OUTPUT_DIR=dist
REM Check if PyInstaller is installed
echo Checking PyInstaller installation...
pip show pyinstaller > nul 2>&1
if %errorlevel% neq 0 (
echo PyInstaller not found. Installing...
pip install pyinstaller
) else (
echo PyInstaller is already installed.
)
REM Create output directory
if not exist "%OUTPUT_DIR%" (
mkdir "%OUTPUT_DIR%"
)
REM Build command - create single file executable
echo Building single-file executable...
pyinstaller ^
--onefile ^
--name "DirTreeGenerator" ^
--distpath "%OUTPUT_DIR%" ^
--workpath build ^
--specpath build ^
--console ^
--clean ^
%SCRIPT_NAME%
REM Check if build succeeded
if exist "%OUTPUT_DIR%\DirTreeGenerator.exe" (
echo.
echo ======================================================
echo Build successful! Executable location:
echo %cd%\%OUTPUT_DIR%\DirTreeGenerator.exe
echo ======================================================
) else (
echo.
echo Build failed. Please check error messages.
)
endlocal
pause