When I run cmd in Windows 7 (by typing 'cmd'
in Windows Run), the following error shows:
'-p' is not recognized as an internal or external command, operable
program or batch file.
I have tried checking PATH in environment variables.
Running echo %PATH%
gives me the following:
C:\Windows\System32;C:\Windows;C:\Windows\System32\WindowsPowerShell\v1.0;C:\xampp\php;
I have checked all the directories being pointed to by PATH. Everything seems to be in place. What I can not understand is where '-p'
is being called. I'm thinking that it has something to do with cmd
since it only comes out when I call cmd
and not when I run ipconfig
or ping
, for example.
Best Answer
It's possible that you have an 'AutoRun' command set in the registry. There's two registry keys, one per-user and one per-computer, that can define commands that are run every time the command processor (
cmd.exe
) is started. They're actually listed incmd /?
.Anyway, try running
cmd /d
and see if that produces the same message. The/d
flag means "don't run AutoRun commands", which makes it perfect for testing this.The registry values are:
Check both. By default, neither should exist. You may wish to fix the command strings in yours, or even delete them entirely.
Related: http://blogs.msdn.com/b/oldnewthing/archive/2007/11/21/6447771.aspx
Alternatively, you could have a batch script or similar set up with the name
cmd
, which is being executed instead of the nativecmd
. Try the commandwhere cmd
to print out a list ofcmd
s in your path, in order of execution. If there are any other than/before the one inC:\Windows\System32\cmd.exe
, you may wish to delete them, or remove their path from your PATH environment variable.