can't i use type command in a for loop command?

  • Thread starter Thread starter thinktwice
  • Start date Start date
T

thinktwice

for ....in (type file.txt|findstr...) do command
dos pompt doesn't accept the above command as a valid command, must i
use a temporarily file ?
 
thinktwice said:
for ....in (type file.txt|findstr...) do command
dos pompt doesn't accept the above command as a valid command, must i
use a temporarily file ?

DOS is an operating system introduced some 30 years ago.
It is only rarely used these days and it cannot do this sort of
thing. However, the Command Prompt under Win2000 can,
e.g. like so in a batch file:

@echo off
for /F "delims=" %%a in ('findstr /c:test list.txt') do "%%a"

which is almost identical to the reply I gave you to your first post.
 
for ....in (type file.txt|findstr...) do command
dos pompt doesn't accept the above command as a valid command, must i
use a temporarily file ?

Note foxidrive's answer to one of you many other questions. That is,
try .something like ...

for ....in (type file.txt ^|findstr...) do command

Tom Lavedas
===========
http://members.cox.net/tglbatch/wsh/
 
Back
Top