Plaul
Plaul

Reputation: 8609

setx command not recognized on Windows10, Windows11

I am installing software on a new laptop with (unfortunately) Windows 10 and the setx command is not recognized:

'setx' is not recognized as an internal or external command

I have Googled this, but can't find anything related to setx and Windows-10.

Do I need to do something specific to enable this command on Windows-10?

Upvotes: 10

Views: 23299

Answers (3)

armagedescu
armagedescu

Reputation: 2158

Try to run setx.exe instead of setx. If it runs, then most probably system variable PATHEXT is missing, is broken in a way or another, or its value misses .EXE. There is how it should look like on a clean windows:

set PATHEXT
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC

The problem can be caused especially by playing with setx command or by editing the system variables other ways.
So, you can restore it:

setx.exe PATHEXT ".COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC"

Consider adding any other important extension if required.

Upvotes: 0

John Miller
John Miller

Reputation: 407

In some cases, it might be because you are in powershell or some other terminal, not in the "command prompt" terminal (remember to open it with admin)

Upvotes: 2

Plaul
Plaul

Reputation: 8609

The answer was given by svasa. It is strange but it worked. The strange thing is that it always was defined in my path, but as "%SystemRoot%\system32". Capitalizing system32 solved the problem. But this was an all new laptop, so I assume this wrong setting came from Microsoft?

Upvotes: 4

Related Questions