.netwindowscmdpath

Environmental variables not working (Windows 11)


I was trying to setup the .NET SDK as I've started learning Unity.

The problem is I can't seem to be able to use dotnet in the CMD. I checked my path to see if the .NET installer included it and it did. Running echo %PATH% in CMD includes C:\Program Files\dotnet\;.

Still I get this error when running 'dotnet' or any dotnet command in CMD:

'dotnet' is not recognized as an internal or external command, operable program or batch file.

When I open a terminal in the C:\Program Files\dotnet\ directory and run 'dotnet' everything works as expected.

It's as if Windows ignores my path. I'm lost and can't find any way to fix it. Any suggestions?


Solution

  • For some reason Windows ignored my user environment variables. Adding C:\Program Files\dotnet\; to my system environment variables instead of my user environment variables seems to have resolved the problem.