Tech Support > Microsoft Windows > FOR command does not work when a command is used to generate the (set).
FOR command does not work when a command is used to generate the (set).
Posted by Marshall Buhl on February 9th, 2006


Hi,

My FOR command does not seem to work properly. I've tried this example from
the Windows help on the FOR command. On other PCs, it works just fine.
Here's what happens on my broken PC:

---
D:\Temp>for /F "usebackq delims==" %i IN (`set`) DO @echo %i
'set' is not recognized as an internal or external command,
operable program or batch file.
---

This should generate a list of environment variables as it does here on
another machine:

---
D:\Temp>for /F "usebackq delims==" %i IN (`set`) DO @echo %i
ALLUSERSPROFILE
APPDATA
<snip>
---

No matter what command I put between the back quotes, it fails. It can be a
shell command such as DIR or an executable file. When I enter just the SET,
DIR, or the executable at the command prompt, they work just fine.

It's not the FOR statement that is broken. It does work when I specify a
file for the (set) and specify tokens .

I have spent most of the day searching the web for help, but found nothing
useful. Help would be greatly appreciated.


Marshall

--
Marshall L. Buhl, Jr.
National Renewable Energy Laboratory
Renewable Energy: Safe, clean energy for a healthy future


Posted by Phil Robyn on February 9th, 2006


Marshall Buhl wrote:
You don't need 'usebackq'.

for /f "delims==" %i in ('set') do @echo %i

--
Phil Robyn
University of California, Berkeley


Similar Posts