What are the reasons to use dos batch programs in Windows?

Posted by DVK on Stack Overflow See other posts from Stack Overflow or by DVK
Published on 2010-04-03T00:21:43Z Indexed on 2010/04/03 0:23 UTC
Read the original article Hit count: 626

Filed under:
|
|
|
|

Question

What would be a good (ideally, technical) reason to ever program some non-trivial task in dos batch language on a modern Windows system as opposed to downloading either PowerShell, or ActiveState Perl?

To be more specific, I make the following two assumptions for the duration of this question:

  • anyone technical enough to be able to write a medium-complexity batch script is technical enough to install either of the scripting interpreters.

  • Neither of those two present enough of a learning curve for basic batch replacement tasks that said curve would outweigh the pain of doing any remotely-non-trivial task in batch.

Notes

  • "You need a batch program for autoexec.bat" is not a valid reason. Your autoexec.bat may consist of simply calling non-batch script.

  • If you disagree with either of my 2 assumptions above, that's fine, and I may be wrong. But my question is specifically "assuming those 2 assumptions are correct, what would be the reason to still stick with batch?" If it makes it easier to suspend disbelief (in case you disagree with me), add in a 3rd assumption that the question is limited to people who already posess at least some modicum of PowerShell or Perl experience.

    To re-iterate - this is not meant to be a subjective question about how easy it is to learn PSh or ASPerl compared to doing advanced batch coding. That is a separate question that is too subjective to be bothered with in this post.

Background:

I used to do some fairly complicated batch programming back in the elder days, and remember batch as one of the worst possble programming languages I had encountered.

The idea for this question came after seeing a bunch of batch questions on SO, and trying to grok the answer of one of them out of sheer curiosity and giving up in pain after a minute, exclaiming mentally "why would anyone go through this pain instead of doing that in 1 line of Perl?" :)

My own plausible answer

I assume there may be an an likely DOS-compatible system, which has DOS interpreter but has no compatible PowerShell or Perl... I'm not aware of one but not completely impossible.

© Stack Overflow or respective owner

Related posts about batch

Related posts about scripting