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

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 ?
 
P

Pegasus \(MVP\)

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.
 
T

Tom Lavedas

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/
 

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