Question Locked

for /f function with dir command results in: 'dir' is not recognized as an

0 helpful
6 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

On only one pc amidst others that run the same command with no issues, a simple command results in " 'dir' is not recognized as an internal or external command,
operable program or batch file. "

PC is XP Pro SP3.

This is the command. Replacing 'dir' with any other command results in the same error.

for /f %a in ('dir') do echo %a

This is run straight from the command line with admin rights and command extensions are confirmed to be enabled.

I'm stumped.

6 replies

by seanferd

cmd /x will enable command extensions for the current cmd session.

They can be permanently enabled with a registry hack.

[HKEY_CURRENT_USER\Software\Microsoft\Command Processor]
"EnableExtensions"=dword:00000001

by cmdr_morph

Thanks seanferd they were enabled, and we still have the same issue...

by seanferd

Even though cmd might indicate that they are enabled? (I'd assume you'd get an error message, but I couldn't know.)

You noted that cmd was running under admin rights, but would that be a local or domain admin? In a domain, you may need domain admin rights.

I keep poking around to see if I can find anything definitive.

by seanferd

Yup. I'm stymied by this as well. And it bugs me.

This discussion is closed to new replies.