Search code examples
windowsrustautomation

How to install Rust using power shell?


I want to install rust automatically via command line on Windows. It doesn't matter if it's power shell or not but I think power shell is the easiest without having to install other stuff manually.

I found https://www.powershellgallery.com/packages/AppVeyorBYOC/1.0.170/Content/scripts%5CWindows%5Cinstall_rust.ps1 but at

 Add-SessionPath "$env:USERPROFILE\.cargo\bin"

it says that Add-SessionPath is a cmdlet that does not exist.


Solution

  • I had the same error. I changed that line to this and the script worked with Powershell 7.

    $env:Path = "$env:USERPROFILE\.cargo\bin"