Repository navigation
Expand file tree
/
Copy pathinstall.bat
More file actions
167 lines (141 loc) · 5.43 KB
/
Copy pathinstall.bat
File metadata and controls
167 lines (141 loc) · 5.43 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
@echo off
echo === Python Dork Opener - Windows setup (Chromium) ===
set "PYTHON_CMD="
py -3 --version >nul 2>nul
if not errorlevel 1 (
set "PYTHON_CMD=py -3"
goto :python_found
)
python --version >nul 2>nul
if not errorlevel 1 (
set "PYTHON_CMD=python"
goto :python_found
)
echo Python was not found, or the Microsoft Store alias is intercepting it.
echo 1. Install Python from https://www.python.org/downloads/ and check
echo "Add python.exe to PATH" during install.
echo 2. If Python IS installed but this still fails, disable the Store alias:
echo Settings ^> Apps ^> Advanced app settings ^> App execution aliases
echo Turn OFF python.exe and python3.exe.
pause
exit /b 1
:python_found
echo Using Python via: %PYTHON_CMD%
where chrome >nul 2>nul
if %errorlevel% neq 0 (
where chromium >nul 2>nul
if %errorlevel% neq 0 (
echo Chromium not found. Attempting install via winget...
winget install --id Hibbiki.Chromium -e --silent --accept-package-agreements --accept-source-agreements
if errorlevel 1 (
echo Could not confirm a fresh Chromium install via winget.
echo If Chromium is already installed this is fine. Otherwise install
echo manually from https://chromium.woolyss.com/ and re-run this script.
)
)
)
set "INSTALL_DIR=%~dp0"
if "%INSTALL_DIR:~-1%"=="\" set "INSTALL_DIR=%INSTALL_DIR:~0,-1%"
if exist "%INSTALL_DIR%\venv\Scripts\python.exe" (
echo Virtual environment already exists, skipping creation.
) else (
%PYTHON_CMD% -m venv "%INSTALL_DIR%\venv"
)
"%INSTALL_DIR%\venv\Scripts\python.exe" -m pip install --upgrade pip
"%INSTALL_DIR%\venv\Scripts\python.exe" -m pip install -r "%INSTALL_DIR%\requirements.txt"
set "LAUNCHER_DIR=%USERPROFILE%\bin"
if not exist "%LAUNCHER_DIR%" mkdir "%LAUNCHER_DIR%"
(
echo @echo off
echo "%INSTALL_DIR%\venv\Scripts\python.exe" "%INSTALL_DIR%\dork.py" %%*
) > "%LAUNCHER_DIR%\dork.bat"
powershell -NoProfile -Command ^
"$dir='%LAUNCHER_DIR%';" ^
"$p=[Environment]::GetEnvironmentVariable('PATH','User');" ^
"if ($p -notlike '*'+$dir+'*') {" ^
" [Environment]::SetEnvironmentVariable('PATH', $p + ';' + $dir, 'User');" ^
" Write-Host ('Added ' + $dir + ' to your user PATH.')" ^
"} else {" ^
" Write-Host ($dir + ' already on PATH.')" ^
"}"
echo.
echo Setup complete.
echo A 'dork' command was created at %LAUNCHER_DIR%\dork.bat
echo.
echo IMPORTANT: open a NEW terminal window for the PATH change to take effect,
echo then run: dork dorks.txt
pause@echo off
echo === Python Dork Opener - Windows setup (Chromium) ===
REM --- Find a working Python interpreter, bypassing the Store alias trap ---
set "PYTHON_CMD="
py -3 --version >nul 2>nul
if not errorlevel 1 (
set "PYTHON_CMD=py -3"
goto :python_found
)
python --version >nul 2>nul
if not errorlevel 1 (
set "PYTHON_CMD=python"
goto :python_found
)
echo Python was not found, or the Microsoft Store alias is intercepting it.
echo 1. Install Python from https://www.python.org/downloads/ and check
echo "Add python.exe to PATH" during install.
echo 2. If Python IS installed but this still fails, disable the Store alias:
echo Settings ^> Apps ^> Advanced app settings ^> App execution aliases
echo Turn OFF python.exe and python3.exe.
pause
exit /b 1
:python_found
echo Using Python via: %PYTHON_CMD%
REM --- Check Chromium / Chrome ---
where chrome >nul 2>nul
if %errorlevel% neq 0 (
where chromium >nul 2>nul
if %errorlevel% neq 0 (
echo Chromium not found. Attempting install via winget...
winget install --id Hibbiki.Chromium -e --silent --accept-package-agreements --accept-source-agreements
if errorlevel 1 (
echo Could not confirm a fresh Chromium install via winget.
echo If Chromium is already installed this is fine. Otherwise install
echo manually from https://chromium.woolyss.com/ and re-run this script.
)
)
)
REM --- Set up project paths ---
set "INSTALL_DIR=%~dp0"
if "%INSTALL_DIR:~-1%"=="\" set "INSTALL_DIR=%INSTALL_DIR:~0,-1%"
REM --- Virtual environment (skip if it already exists) ---
if exist "%INSTALL_DIR%\venv\Scripts\python.exe" (
echo Virtual environment already exists, skipping creation.
) else (
%PYTHON_CMD% -m venv "%INSTALL_DIR%\venv"
)
REM --- Install dependencies using the venv's own python.exe directly ---
REM (avoids relying on activate.bat / PATH, which is what breaks across machines)
"%INSTALL_DIR%\venv\Scripts\python.exe" -m pip install --upgrade pip
"%INSTALL_DIR%\venv\Scripts\python.exe" -m pip install selenium
REM --- Create the `dork` launcher command ---
set "LAUNCHER_DIR=%USERPROFILE%\bin"
if not exist "%LAUNCHER_DIR%" mkdir "%LAUNCHER_DIR%"
(
echo @echo off
echo "%INSTALL_DIR%\venv\Scripts\python.exe" "%INSTALL_DIR%\dork.py" %%*
) > "%LAUNCHER_DIR%\dork.bat"
REM --- Add launcher dir to USER PATH safely (no truncation, no duplicates) ---
powershell -NoProfile -Command ^
"$dir='%LAUNCHER_DIR%';" ^
"$p=[Environment]::GetEnvironmentVariable('PATH','User');" ^
"if ($p -notlike '*'+$dir+'*') {" ^
" [Environment]::SetEnvironmentVariable('PATH', $p + ';' + $dir, 'User');" ^
" Write-Host ('Added ' + $dir + ' to your user PATH.')" ^
"} else {" ^
" Write-Host ($dir + ' already on PATH.')" ^
"}"
echo.
echo Setup complete.
echo A 'dork' command was created at %LAUNCHER_DIR%\dork.bat
echo.
echo IMPORTANT: open a NEW terminal window for the PATH change to take effect,
echo then run: dork dorks.txt
pause