标签:exe goto errorlevel Windows echo 批处理 Ruby wait
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
|
@echo This batch will install Ruby 3.1.2 almost automatically.
ruby.exe -v
@if errorlevel 1 goto :skip
@echo Ruby had installed.
@echo If the version of Ruby is lower than 3.1, please uninstall the old Ruby.
@echo Then you can run this batch to install 3.1.2.
@goto :wait
:skip
chdir %HOMEDRIVE%%HOMEPATH%
curl.exe -o install_ruby.exe https://s3.jcloud.sjtu.edu.cn/899a892efef34b1b944a19981040f55b-oss01/github-release/oneclick/rubyinstaller2/releases/download/RubyInstaller-3.1.2-1/rubyinstaller-devkit-3.1.2-1-x64.exe
@if errorlevel 1 goto :error1
install_ruby.exe /verysilent /dir=C:\Ruby /tasks="modpath,assocfiles,ridkinstall,defaultutf8"
@if errorlevel 1 goto :error2
if not exist C:\Ru mkdir C:\Ru
@if errorlevel 1 goto :error3
setx.exe RUBYLIB C:\Ru
@if errorlevel 1 goto :error4
setx.exe PATH "%PATH%;C:\Ru"
@if errorlevel 1 goto :error4
@goto :wait
:error1
@echo Download Ruby install package fail.
@goto :wait
:error2
@echo Run Ruby install package fail.
@goto :wait
:error3
@echo Make Ruby library directory fail.
@goto :wait
:error4
@echo Set user environment variable fail.
@goto :wait
:wait
@pause
|
标签:exe,
goto,
errorlevel,
Windows,
echo,
批处理,
Ruby,
wait
From: https://www.cnblogs.com/fitmap/p/16922599.html