After installing rust on my windows 7 computer, I decided to run a simple hello world program in vscode in a file named main.rc, but on putting the following code in terminal
rustc main.rc
in order to run main.rc, my terminal started giving the following messages:
'rustc' is not recognized as an internal or external command,
operable program or batch file.
I also put the following code in terminal
cargo init
and this time also my terminal gave the following message
'cargo' is not recognized as an internal or external command,
operable program or batch file.

Then I thought to put all installed rust folders in my C drive where my python folders were also present

But no change occurred. Then I thought to put rustc file path to environment variables, but still, all these efforts went in vain.

For me, instructions such as rustc main.rs worked in PowerShell and the Command Prompt, but they did not work in Visual Studio Code's Terminal.
Restarting my computer fixed the problem.
I went through that in the past using Windows. I didn't have Microsoft C++ Build Tools installed. As you are using Windows
Make sure you have Microsoft C++ Build Tools installed (Download it here)
Download and install RUSTUP-INIT.EXE (Download the 32-BIT here, Download the 64-BIT here). One can also download from here.
For other Rust installation methods, read this page.
One can also use Windows Subsystem for Linux. If that's the case, run the following and follow the instructions.
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
For additional information on how to install, check this link.
Once the installation is complete, you may want to consider using an IDE. Here you'll see comparison of various editor features. At the present time, VS Code and IntelliJ.
If you end up using IntelliJ, you'll want this plugin.
In case you end up having problems with Rust in the future, apart from posting your question on SO with the tag rust you may want to consider the following discussion platforms:
Official Discord
Official Users Chat
Mozilla Matrix Chat
Rust Subreddit
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With