FOR command causes cmd window to exit

  • Thread starter Thread starter Kok Yong Lee
  • Start date Start date
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?
 
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?
 
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?
 
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"?
 
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.
 
Back
Top