FOR command causes cmd window to exit

K

Kok Yong Lee

hi there,

I bumped into a weird machine in my office where in the command window when
I type in
FOR /F "usebackq delims==" %i IN (`set`) DO @echo %i

and hit enter, the command window will just close down completely like I
just issue the EXIT command.

This only happen to
FOR /F ["options"] %variable IN (`command`) DO command
[command-parameters]

If i just use the FOR to parse the content of a file, then everthing just
work as expected.

Anyone seen this kind of problem before?
 
F

foxidrive

Random Windows behaviour? It works here, but is there some reason you are
using usebackq?

FOR /F "delims==" %i IN ('set') DO @echo %i

Forgot to mention the Os is WinXp SP2

Kok Yong Lee said:
hi there,

I bumped into a weird machine in my office where in the command window
when I type in
FOR /F "usebackq delims==" %i IN (`set`) DO @echo %i

and hit enter, the command window will just close down completely like I
just issue the EXIT command.

This only happen to
FOR /F ["options"] %variable IN (`command`) DO command
[command-parameters]

If i just use the FOR to parse the content of a file, then everthing just
work as expected.

Anyone seen this kind of problem before?
 
K

Kok Yong Lee

Not really, I only copy the exmapel command from FOR /? to try out.

It is the same behaviour as well for "FOR /F "delims==" %i IN ('set') DO
@echo %i"

It is definately weird ebahviour but not random as it is reproducible every
time.


foxidrive said:
Random Windows behaviour? It works here, but is there some reason you are
using usebackq?

FOR /F "delims==" %i IN ('set') DO @echo %i

Forgot to mention the Os is WinXp SP2

Kok Yong Lee said:
hi there,

I bumped into a weird machine in my office where in the command window
when I type in
FOR /F "usebackq delims==" %i IN (`set`) DO @echo %i

and hit enter, the command window will just close down completely like I
just issue the EXIT command.

This only happen to
FOR /F ["options"] %variable IN (`command`) DO command
[command-parameters]

If i just use the FOR to parse the content of a file, then everthing
just
work as expected.

Anyone seen this kind of problem before?
 
E

Esra Sdrawkcab

Kok said:
Not really, I only copy the exmapel command from FOR /? to try out.

It is the same behaviour as well for "FOR /F "delims==" %i IN ('set') DO
@echo %i"

It is definately weird ebahviour but not random as it is reproducible every
time.


foxidrive said:
Random Windows behaviour? It works here, but is there some reason you are
using usebackq?

FOR /F "delims==" %i IN ('set') DO @echo %i

Forgot to mention the Os is WinXp SP2

hi there,

I bumped into a weird machine in my office where in the command window
when I type in
FOR /F "usebackq delims==" %i IN (`set`) DO @echo %i

and hit enter, the command window will just close down completely like I
just issue the EXIT command.

This only happen to
FOR /F ["options"] %variable IN (`command`) DO command
[command-parameters]

If i just use the FOR to parse the content of a file, then everthing
just
work as expected.

Anyone seen this kind of problem before?
Maybe a prank synonym of "set" to "For"?
 
F

foxidrive

Random in terms of different Windows installations can behave differently.
(There's an entire MS knowledgebase out there dedicated to those things...)

There is also a random behaviour in a CMD window at times which is fixed with a
reboot.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top