31 lines
798 B
Batchfile
31 lines
798 B
Batchfile
@echo off
|
|
setlocal
|
|
title Install Rust toolchain (rustup)
|
|
|
|
rem rustup installs per user (%USERPROFILE%\.cargo), so run this as the user who will use Rust.
|
|
rem The default msvc toolchain needs the MSVC Build Tools (see 20-Install-MSVC-Admin.bat).
|
|
|
|
set "INSTALLER=%TEMP%\rustup-init.exe"
|
|
|
|
echo Downloading rustup-init...
|
|
curl.exe -L --fail -o "%INSTALLER%" https://win.rustup.rs/x86_64
|
|
if errorlevel 1 (
|
|
echo Download failed.
|
|
pause
|
|
exit /b 1
|
|
)
|
|
|
|
echo Installing the stable Rust toolchain...
|
|
"%INSTALLER%" -y --default-toolchain stable --profile default
|
|
set "RC=%ERRORLEVEL%"
|
|
|
|
del "%INSTALLER%" >nul 2>&1
|
|
|
|
if "%RC%"=="0" (
|
|
echo Done. Open a new terminal to pick up the updated PATH.
|
|
) else (
|
|
echo rustup-init exited with code %RC%.
|
|
)
|
|
pause
|
|
exit /b %RC%
|