Files
cloudhost/seediso/windows11/40-Install-Rustup.bat
T
2026-10-20 12:52:17 +08:00

40 lines
1.1 KiB
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"
rem PROCESSOR_ARCHITEW6432 holds the real architecture when this runs under emulation.
set "ARCH=%PROCESSOR_ARCHITECTURE%"
if defined PROCESSOR_ARCHITEW6432 set "ARCH=%PROCESSOR_ARCHITEW6432%"
if /i "%ARCH%"=="ARM64" (
set "RUSTUP_ARCH=aarch64"
) else (
set "RUSTUP_ARCH=x86_64"
)
echo Downloading rustup-init (%RUSTUP_ARCH%)...
curl.exe -L --fail -o "%INSTALLER%" https://win.rustup.rs/%RUSTUP_ARCH%
if errorlevel 1 (
echo Download failed.
if not defined INSTALL_ALL 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%.
)
if not defined INSTALL_ALL pause
exit /b %RC%