Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
I put these lines in a bat:
@echo off
for %%N in (1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20) do echo %%N > pix\%%N.bmpIt doen't work.
It's sitting directly above the pix directory.It makes one file: %N.bmp
I am totally at a loss.
FWIW, it works as expected in w2k cmd.exe box.
TIA
M2

It's been a while, but don't you need the double pipe, to concatenate into an existing file??
Ie >> versus >

My suspicion is that WhitPhil is correct. He always is. But just in case, the real batch file experts are in the Dos forum.

I agree with all of the above other than it's not called a pipe, the pipe was a vertical line with a split in the middle (to the left of the "1" key) and was used to combine more than one instruction on a line (past tense as it was dropped in win95 I think). I call ">" chevrons cos it sounds posh and makes people think I know what I am on about
Techy n Welsh

In this case, 'Pipe' is actually the name for the action and not the symbol. In other words you are 'pipeing' the output to somewhere it doesn't normally go.

"for.. in.. do" the set elements are usually separated by commas - never tried it without them
Single redirect > creates or overwrites the target file, double redirect >> appends to it
Drop the last year into the silent limbo of the past. Let it go, for it was imperfect, and thank God that it can go.

Thanks for all that.
The vertcal bar is alive and well. I use it every day and think of it as 'pipe' but I think that's not it's name.
And the > I call redirect, but chevron is certainly more posh.
Although I'm not sure what the prob is, hence the question, I'm sure that it doesn't need the >>.
I think jboy may have the key.
But I'm almost sure I've seen bats with:
for %%C in (call del) do %%C some.bat
[no commas]
Yeah, there's plenty of smarts and experience in the DOS forum. But there's also a couple guys on the verge of a mental breakdown and I don't want to be the one to push them over the edge.
I'll let you know.
M2

Yeah, a little research indicates that a space is enough of a delimiter.
What does the set represent? You have a directory containing files numerically named but with no extension?
Drop the last year into the silent limbo of the past. Let it go, for it was imperfect, and thank God that it can go.

Ah, ok.
Well, all that does is echo each numeral to the redirect, which saves it as %N.BMP
Single > causes the file to be overwritten, so the file contains the final input as text: '20'
Double >> appends, yielding a textfile containing numbers 1 through 20
This won't do what you want
Drop the last year into the silent limbo of the past. Let it go, for it was imperfect, and thank God that it can go.

jboy,
Yes, I know.
I just tried it with command.com in w2k and it works.
BTW, I liked you response to Manual Labor. The world is full of wingnuts.
M2

Heh - we do get occasional wandering troll come by to try and stir things up (as if that's necessary).
Yeah - I dunno, I can't see it working in 'real' DOS using echo - different plan of attack seems needed. Been quite a while since I've used DOS 'creatively' though.
Drop the last year into the silent limbo of the past. Let it go, for it was imperfect, and thank God that it can go.

I'm really at a loss.
This started in response to a guy who wants to randomly select 20 BMPs.
The bat that's troubling me is simply to create a bunch of BMPs so I "have something to work with."
In w2k I just did for /L %%I in (1,1,2000)
and it cooks. But no for /L in DOS.I guess I'll need to
for in call
But I'm amazed it doesn't work as is.
M2

Hi Gang,
As Pooh says, "curiouser and curiouser."
It works if I do for in call and the bat called contains:
echo %1 > 98pix\%1.bmp
As with so many things in DOS/winders, I don't know why it does, it JUST DOES.
As long as we're in this deep...
I asked the requestor if he might do it in w2k. No he can't.
But one of the really slick things built into 2k is the %random% var.
A little unscientific testing indicates that the %random% var does a pretty good job, as defined by no obvious pattern.
Question: what does 2k use to generate %random% ?
Keep it simple. I don't have a PHD in math.
TIA
M2

![]() |
SU-0013 Error On 95 Upgra...
|
Windows 98 and WD120gig S...
|

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |