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

By cmdr_Morph ·
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.

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Answers

Collapse -

Command Extensions must be enabled.

by seanferd In reply to for /f function with dir ...

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]

Collapse -

Command Extensions are enabled - but problem persists.

by cmdr_Morph In reply to Command Extensions must b ...

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

Collapse -

Any sort of Group Policy which might disable them?

by seanferd In reply to Command Extensions are en ...

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.

Collapse -

Bump, because I still have no clue.

by seanferd In reply to Any sort of Group Policy ...

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

Collapse -

Still no ideas on this?

by seanferd In reply to Bump, because I still hav ...

I'm curious, even if the OP is long gone.

Related Discussions

Related Forums