%Windir% Not Recognized Error

%Windir% Not Recognized Error

I am trying to run the command %windir% in a command prompt, but I am getting an below error:

2

4 Answers

Strangely enough, no one has explained the entire story, i.e. the error.

Indeed %windir% is an variable, and its contents on your system are C:\Windows.
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 ;-)

2

%windir% is a variable and should be used in conjunction with standard commands or actions.

For example CD %WINDIR% will take you to the windows directory...

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).

1

when you do %windir% you are meant to use it with other commands with it. so that is why there is an error. for example if you do cd %windir%, you will not get an error

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Chloe Bennett
Author

Chloe Bennett

Chloe Bennett explores the intersection of pop culture, streaming entertainment, digital trends, and contemporary lifestyle. Her weekly commentary reaches thousands of culture enthusiasts.