Skip to content

Instantly share code, notes, and snippets.

@david-lafontant
Forked from nak1114/install-rbenv-win.bat
Created June 22, 2022 16:18
Show Gist options
  • Save david-lafontant/374990da67687e0d345c895004f5b6b4 to your computer and use it in GitHub Desktop.
Save david-lafontant/374990da67687e0d345c895004f5b6b4 to your computer and use it in GitHub Desktop.
Batch for install rbenv-win (require windows Vista+)
@echo off
setlocal
rem Set your rbenv directry
set instpath="%USERPROFILE%\.rbenv-win"
rem Clone git repositry
call git clone https://github.com/nak1114/rbenv-win.git %instpath%
rem Config path
rem Add the bin & shims directory to your PATH environment variable for access to the rbenv command
rem get current PATH environment
for /f "skip=2 delims=" %%a in ('reg query HKCU\Environment /v Path') do set orgpath=%%a
rem update PATH environment
reg add HKCU\Environment /v Path /d "%instpath%\bin;%instpath%\shims;%orgpath:~22%" /f
setx RBENV_ROOT %instpath%
rem check new PATH environment
for /f "skip=2 delims=" %%a in ('reg query HKCU\Environment /v Path') do set orgpath=%%a
echo New PATH user local environment variable :"%orgpath:~22%"
echo.
rem Restart your shell
echo Please restart your shell
echo.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment