I am trying to run the command
%windir% in a command prompt, but I am getting an below error:
Strangely enough, no one has explained the entire story, i.e. the error.
%windir% is an variable, and its contents on your system are
So when you 'execute'
%windir% its contents are substituted and your command is
C:\Windows, which, as Windows informs you is not recognized as an internal or external command, operable program or batch file.
A fun experiment would be to place an executable named
windows.exe in your
C:\ root ;-)
You must be used to a different shell (in particular 4DOS/4NT/TakeCommand) where a directory name is treated as a command to change to that directory. That’s not the case with CMD, and you have to use
CD before it (if it is already on the same drive. I don’t know if CMD has
cdd command to change drive and directory).