-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathautomator.bat
More file actions
48 lines (43 loc) · 1.68 KB
/
Copy pathautomator.bat
File metadata and controls
48 lines (43 loc) · 1.68 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
::A* -------------------------------------------------------------------
::B* A simple wrapper script for running automation tasks more smoothly
::-* without needing to know the exact python interpreter path
::C* Copyright 2025 by Martin Urban.
::D* -------------------------------------------------------------------
::E* It is unlawful to modify or remove this copyright notice.
::F* -------------------------------------------------------------------
::G* Please see the accompanying LICENSE file for further information.
::H* -------------------------------------------------------------------
::I* Additional authors of this source file include:
::-*
::-*
::-*
::Z* -------------------------------------------------------------------
@echo off
:: Do NOT add any automation logic here! Please use the automations.py for that!
if "%1"=="init" (
if exist .\.venv\Scripts\python.exe (
echo Virtual environment already exists. Nothing to do.
exit /b 0
)
:: Check if Python is available
python --version >nul 2>&1
if %errorlevel% neq 0 (
echo Error: Python is not installed or not added to the PATH.
exit /b 1
)
:: Create the virtual environment in .venv
echo Creating virtual environment in .venv...
python -m venv .venv
if %errorlevel% neq 0 (
echo Error: Failed to create the virtual environment.
exit /b 1
)
echo Virtual environment created successfully in .venv.
exit /b 0
)
if exist .\.venv\Scripts\python.exe (
:: Default behavior: Run automations.py
.\.venv\Scripts\python.exe .\automations\my_automator.py %*
) else (
echo Virtual environment does not exist yet! Please run automator.bat init
)