I just solved this same problem!
The way I made it is that you have to add the filepath to the user environment variables, not system variables, more specifically I added it to the "Path" variable in the User variables.
So the steps that I used would be:
- get the filepath to the "mongosh.exe" file (The file path without the "\mongosh.exe" at the end, so it should look something like this: "...\mongosh-1.10.6-win32-x64\bin").
- Open environment variables
- In the top part of the environment variables tab, the will be a seccion called "User variables for your user", under this there will be a box containing a number of variables, in those there will be one called "Path", this is the one we are going to edit, so click on it, it should become blue.
- To edit this variable, still in the top part, click on the button that says "Edit..." (notice that this is the button that is below all the variables in the top section, I specify this since there is two sections that contain the same buttons, so just stick to the top one).
- Once you clicked edit, it should have opened another tab called "Edit environment variable", this tap is a list of file paths (or with none in case you have never enter a file path there), with some buttons on the left. You need to click the button that says "New".
- Once you clicked "New" it should have added a place where you can put the filepath to the "mongosh.exe" file, put the file path, and hit enter.
- Then press "ok" at the bottom left, to confirm the changes.
- In the "Environment Variables" tab, press "ok" in the bottom left to finalize the process.
Now it is done. For good measured I rebooted my pc when I did this, but I'm not sure if it is necessary, perhaps it suffices with just restarting VScode, but like I said, I rebooted my pc for good measure.
This is wat worked in my case, because I was following in a YouTube video that didn't work for me. I don't know why it is the case, but I had this Idea since I once had to install a MinGW (c++ compiler) and this is what had to be done.
Anyways, hope it helped ! :)