another FOR question

  • Thread starter Thread starter djc
  • Start date Start date
D

djc

The FOR command allows you to run a command on each %i variable.. so, when
running this the command prompt displays each instance of the command run as
well as it's output. Is there a way to suppress only the command from
displaying but allowing the output from each command to display? I'm looking
for a way to trim down and format the output.

for example using a FOR command to run a DIR on some list would look like
this:
c:\DIR element1
File Not Found

c:\DIR element2
File Not Found

c:\DIR element3
File Not Found

etc.. etc..

I'm looking for a way to only display:
File Not Found
File Not Found
File Not Found

any input is appreciated. thanks.
 
whoops.. forgot to mention an important point. The specific need I have is
for a command that I run... its not a batch file. I know, I could make it a
batch file and problem solved. Or just type echo off before executing the
command... or to keep in on comand I could type echo of && mycommand..
either way.. thank you. echo off is the answer. For some reason I was
thinking of redirecting using 1>null or the 2>nul stuff... totally forgot
echo off can be used outside of batch files.

Thank you!
 
For ... do @dir

The @ sign suppresses the display of the command.

djc said:
The FOR command allows you to run a command on each %i variable.. so, when
running this the command prompt displays each instance of the command run as
well as it's output. Is there a way to suppress only the command from
displaying but allowing the output from each command to display? I'm looking
for a way to trim down and format the output.
for example using a FOR command to run a DIR on some list would look like
this:
c:\DIR element1
File Not Found
c:\DIR element2
File Not Found
c:\DIR element3
File Not Found
etc.. etc..
 
Back
Top