I'm a newbie at writing DOS batch files. I've tried to look for it, but I can't seem to figure out how to read from an input file. Is there an equivalent of a cin statement in DOS Batch programming.

Batch files are just a way of grouping together calls to programs and system commands. Everything in a batch file is just something that you can do on the command line. The power comes from being able to group together numerous calls to execute a series of steps. If you are creative in how you use the tools that you have access to, you can create some seemingly intelligent behavior.

I have a feeling that you may be expecting too much out of batch files, but it could be possible to do what you want. What exactly is it that you want to do?

You're right, I was expecting too much... I worked around it by having the autoexec.bat call a C++ program that served as a batch file except with more functionality.

Thanks....
AJ

What you might want to do is install something like Python or Ruby and write your scripts in that.
No need for compilers.

Compiled languages seem to be fading. :p
Yeah I heard ruby was good too tho.

I'm a newbie at writing DOS batch files. I've tried to look for it, but I can't seem to figure out how to read from an input file. Is there an equivalent of a cin statement in DOS Batch programming.

Some people have figured out how to do quite a good bit of processing work via batch files: ftp://137.193.64.130/pub/

What you might want to do is install something like Python or Ruby and write your scripts in that.
No need for compilers.

Or you can install AutoIt. And you can optionally compile & compress your scripts too if you don't want to force your clients to download a runtime engine.

Compiled languages seem to be fading. :p
Yeah I heard ruby was good too tho.

No...the pendulum is swinging back the other way now. When was the last time that CPU clock speed doubled? As users continue to demand more functionality and more eye-candy multimedia, it will be up to the software to pull it off -- and that can't be done with interpreted languages and virtual machines.

you can do simplistic read ins to a variable using
set /p var="display: "

From my experience batch is extremely limited. You can do simple things but that's about it. For example, if you've ever tried using conditionals in a for loop in batch you'd understand that inside conditionals are evaluated before the for loop executes. Your cout for batch is echo which is extremely limited in that it always returns a \n at the end of its output. There is a workaround set /p var=" " < NUL but still batch is more trouble than its worth.

commented: Worthless addition does not help the OP at all, and 6 years late to boot -3
commented: don't revive zombies -3
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.