-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathsetup.bat
More file actions
42 lines (34 loc) · 1.1 KB
/
setup.bat
File metadata and controls
42 lines (34 loc) · 1.1 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
@echo off
setlocal EnableDelayedExpansion
:: Get script directory
set "SCRIPT_DIR=%~dp0"
set "SCRIPT_DIR=%SCRIPT_DIR:~0,-1%"
:: Create virtual environment if it doesn't exist
if not exist "%SCRIPT_DIR%\venv" (
echo Creating virtual environment...
python -m venv "%SCRIPT_DIR%\venv"
)
:: Install dependencies
echo Installing dependencies...
call "%SCRIPT_DIR%\venv\Scripts\pip" install -U selenium python-dotenv bs4
:: Ask for alias creation
echo.
set /p "ADD_ALIAS=Do you want to add 'ktasexport' command to your PATH? [Y/n] "
if /i "!ADD_ALIAS!"=="n" goto :eof
:: Create batch file for the command
set "CMD_FILE=%USERPROFILE%\ktasexport.bat"
(
echo @echo off
echo "%SCRIPT_DIR%\run.bat" %%*
) > "%CMD_FILE%"
:: Add command directory to PATH if not already present
for %%I in ("%USERPROFILE%") do set "USER_DIR=%%~fI"
echo !PATH! | findstr /i /c:"!USER_DIR!" >nul
if errorlevel 1 (
setx PATH "!USER_DIR!;!PATH!"
echo Added user directory to PATH
)
echo.
echo To use the 'ktasexport' command in this terminal session, please restart your terminal
echo or run: set "PATH=!USER_DIR!;!PATH!"
endlocal