Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

On one of my servers (2008 R2) powershell refuses to run executables without extension, so typing cmd (or &cmd) in command prompt results in folowing error message:

The term 'cmd' is not recognized as the name of a cmdlet

Invoking executable one of the following ways pops out separate window (which executes asynchronously in respect to parent). I've tried that in x86 version of powershell and in x64 one. I've tried -Noprofile argument. PATH seems to be OK. It includes System32 and all.

The only way I've managed to execute cmd inline form powershell is opening standard cmd.exe shell, executing powershell.exe from it and executing cmd /c echo test from it. Inception, huh?

What should I try next?

share|improve this question
What does &cmd do? – jscott Jun 25 '12 at 16:20
It complains about unknown cmdlet. & cmd.exe pops separate window with command-line interpreter. & cmd.exe /c echo "test" executes echo in separate window and closes it after execution. & cmd.exe /c dir c:\windows\system32 pops separate window scrolling contents of system folder but parent window do not wait for it (command prompt is available for next command right away) – Artem Tikhomirov Jun 25 '12 at 16:23
Strange. What does $env:PATHEXT show? – jscott Jun 27 '12 at 1:32
$env:PATHEXT -eq $null returns 'True' – Artem Tikhomirov Jul 4 '12 at 14:18
@jscott that's exactly the problem! That registry value is absent for some reason. If you make your comment an answer, I will accept it with pleasure. – Artem Tikhomirov Jul 5 '12 at 13:47
up vote 2 down vote accepted

From our comment exchange, it appears that the System Environment Variable %PATHEXT% is not set. This is preventing the OS from determining which file extensions should be checked when searching for executables. This system variable is derived from the the following registry value:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\PATHEXT

If this value is missing, you may recreate it with the following:

REG ADD "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /t REG_SZ /v "PATHEXT" /d ".COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC" /f
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.