4 ms·
In computing, "batch" connotes long running processes in addition to "script"'s connotation of collapsing multiple commands into a single one. The seemingly red
by brudgers 10y ago
In computing, "batch" connotes long running processes in addition to "script"'s connotation of collapsing multiple commands into a single one. The seemingly redundant parsing by the Batch interpreter is a feature, not a bug.
1. The parser allows modifying a .bat file during its execution and having those changes execute without restarting the Batch interperter. [1] This is in keeping with the rationale for batch processing -- facilitating serial execution of computationally expensive operations.
2. The Batch interpreter allows self modifying code.[2] In the early 1980's when Batch was designed, sophisticated COBOL programmers might have felt right at home. Lisper's were probably more hit and miss.
This is a case where historical context is useful. Today, it might perhaps be worth mentioning Powershell in a discussion of the Windows command line. Batch was the DOS command line and exists in Windows for evolutionary reasons.
In the days when abundant RAM and fast CPU speeds were prefixed with "mega" and distributed computing often happened at BAUD rates, not restarting a process was a big deal. More importantly, then as today, the execution speed of the batch interpreter was not a critical section of a batch process.
[1]: https://stackoverflow.com/questions/906586/changing-a-batch-file-when-its-running https://stackoverflow.com/questions/906586/changing-a-batch-...
[2]: http://swag.outpostbbs.net/DOS/0019.PAS.html http://swag.outpostbbs.net/DOS/0019.PAS.html
- Roboprog 10y agoI remember when I learned that command.com kept the current .bat file open when running it, rather than reading it into memory (like most other interpreters that I used or learned at school). We had a client on a Novell network with a menu program that generated .bat files to start the program selected, then restart the menu program. This turned out not to work very well on a multi-user network, as user A would exit an app, and continue running the .bat at some offset, which user B would now have caused to have different content, and probably not even a line break at said offset into "THE" file. Easy enough to fix by having the menu program put the run script (.bat file) into the Novell equivalent of each user's home directory, but it was a real WTF moment at first :-)
- j2kun 10y agoBut bash was around in the 80's, too, right? And it didn't seem to need those features. How did bash users get around your claimed need for this?
- bluejekyll 10y agofork/exec is built in to bash, i.e. Unix. Batch was restricted by DOS, I wish I had never learned it, but it did come in handy for launching games.
- brudgers 10y agoIn the Savings and Loan recession I had one of those jobs with unpaid overtime and an employer who was comfortable abusing it. I'd start a batch print job and go home. When I came back next morning picking up the paper off the floor was pure pleasure relative to baby-sitting the machines until midnight or more.
- userbinator 10y agoBash first came out in 1989, but the typical shell of the time was sh, and it ran on Unix systems with more memory, storage, and CPU power than the typical PC. Thus it's no surprise that the sh family started with more features, while COMMAND which cmd evolved from was extremely minimalistic. DOS 1.0's COMMAND.COM was just slightly more than 3 kilobytes and didn't have conditional nor goto statements: http://www.os2museum.com/wp/dos/dos-1-0-and-1-1/dos-1-0-dir/ http://www.os2museum.com/wp/dos/dos-1-0-and-1-1/dos-1-0-dir/ http://www.os2museum.com/wp/dos/dos-1-0-and-1-1/ http://www.os2museum.com/wp/dos/dos-1-0-and-1-1/
- Roboprog 10y agoEven if the *nix machine was no bigger than a PC (e.g. - Xenix on '286; BSD on a PDP-11), it could still swap out processes, vs sharing a single real memory space. But as you said, this allowed (at least the illusion, on some machines) more total memory to work with.
- 10y ago