-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.cmd
49 lines (41 loc) · 1.83 KB
/
install.cmd
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
@echo off
if not exist %USERPROFILE%\.pywin-venv\ (
mkdir %USERPROFILE%\.pywin-venv\
)
curl https://raw.githubusercontent.com/fiziechemi/pywin-venv/master/pywin-venv/init.bat -o %USERPROFILE%\.pywin-venv\init.bat
curl https://raw.githubusercontent.com/fiziechemi/pywin-venv/master/pywin-venv/pyenv.bat -o %USERPROFILE%\.pywin-venv\pyenv.bat
reg query "HKLM\Software\Microsoft\Command Processor" /v AutoRun >nul 2>nul
if %ERRORLEVEL% EQU 0 (
goto editReg
) else (
goto addReg
)
:editReg
for /f "tokens=3" %%a in ('reg query "HKLM\Software\Microsoft\Command Processor" /V AutoRun ^|findstr /ri "REG_EXPAND_SZ"') do set regValue=%%a
reg delete "HKLM\Software\Microsoft\Command Processor" /v AutoRun /f >nul 2>nul
if not %ERRORLEVEL% EQU 0 (
echo ERROR: Access is denied. Please execute code as an administrator.
goto end
)
reg add "HKLM\Software\Microsoft\Command Processor" /v AutoRun /t REG_EXPAND_SZ /d "%%USERPROFILE%%\.pywin-venv\init.bat" /f >nul 2>nul
if not %ERRORLEVEL% EQU 0 (
echo ERROR: Access is denied. Please execute code as an administrator.
) else (
echo The installation completed successfully.
if "%regValue%"=="%%USERPROFILE%%\.pywin-venv\init.bat" (
echo AutoRun registry changed in "HKLM\Software\Microsoft\Command Processor".
echo [Name] [Type] [Data]
echo Old registry: Autorun REG_EXPAND_SZ "%regValue%"
echo New registry: Autorun REG_EXPAND_SZ "%%USERPROFILE%%\.pywin-venv\init.bat"
)
)
goto end
:addReg
reg add "HKLM\Software\Microsoft\Command Processor" /v AutoRun /t REG_EXPAND_SZ /d %%USERPROFILE%%\.pywin-venv\init.bat /f >nul 2>nul
if not %ERRORLEVEL% EQU 0 (
echo ERROR: Access is denied. Please execute code as an administrator.
) else (
echo The installation completed successfully.
)
:end
start /b del %USERPROFILE%\install.cmd