-
Notifications
You must be signed in to change notification settings - Fork 10
/
install.bat
33 lines (26 loc) · 1.19 KB
/
install.bat
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
@echo off
setlocal enabledelayedexpansion
REM Set yenpath variable to the user's .yen\bin directory
SET "yenpath=%userprofile%\.yen\bin"
REM Create the .yen\bin directory if it doesn't exist
mkdir "%yenpath%" 2>nul
REM Download yen executable and save it to the .yen\bin directory
SET "download_url=https://github.com/tusharsadhwani/yen/releases/latest/download/yen-rs-x86_64-pc-windows-msvc.exe"
curl -SL --progress-bar "%download_url%" --output "%yenpath%\yen.exe"
REM Download userpath and microvenv too
curl -SL --progress-bar "https://yen.tushar.lol/userpath.pyz" --output "%yenpath%\userpath.pyz"
curl -SL --progress-bar "https://yen.tushar.lol/microvenv.py" --output "%yenpath%\microvenv.py"
REM Get the user's PATH without the system-wide PATH
for /f "skip=2 tokens=2,*" %%A in ('reg query HKCU\Environment /v PATH') do (
set "UserPath=%%B"
goto :Continue
)
:Continue
REM Check if the directory .yen\bin exists in the user's PATH
echo !UserPath! | findstr /i /c:".yen\bin" >nul
if errorlevel 1 (
REM If it doesn't exist, append !yenpath! to the user's PATH
setx PATH "!UserPath!;!yenpath!"
)
endlocal
echo Successfully installed yen! Restart the shell to start using the 'yen' command.