什么是Windows使用DOS批处理程序的原因是什么? [英] What are the reasons to use dos batch programs in Windows?

查看:136
本文介绍了什么是Windows使用DOS批处理程序的原因是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么是相对于下载一个很好的(理想情况下,技术)的理由永远编程一个在现代Windows系统上DOS批处理语言中的一些不平凡的任务或者PowerShell或ActiveState公司的Perl?

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:


  • 任何人足够的技术,能够写一个中等复杂批处理脚本是足够的技术来安装这脚本间preters的。

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

无论这两个present足够提到曲线将超过批量做任何远程-不平凡的任务的疼痛基本批量更换任务的学习曲线的。

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.

备注


  • 你需要AUTOEXEC.BAT批处理程序不是一个充分的理由。您的AUTOEXEC.BAT也许仅仅是调用非批处理脚本。

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

如果您有任何的我的上述2假设不同意,那很好,我可能是错的。但我的问题是明确假设那些2假设是正确,这将是仍然有一批坚守的原因吗?如果它可以更容易暂停怀疑(如果你不同意我),加入第3假设问题仅限于谁已经posess至少有一些PowerShell的或Perl些许经验的人。

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.

再次重申 - 这并不意味着是它是多么容易学习PSH或ASPerl相比,做先进的批号打码一个主观的问题。这是一个单独的问题是太主观,在这个帖子被人打扰。

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.

背景

我用来做一些相当复杂的批处理编程回到老日子,记住批次,因为我曾遇到的最糟糕的编程语言之一。

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

有关这个问题的想法,看见一堆的SO批次的问题,并试图神交其中一人回答出来的纯粹的好奇心,一分钟后,在痛苦中放弃后传来,精神上感叹为什么会有人经过这种痛苦的,而不是做,在1号线的Perl? :)

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?" :)

我自己的答案似是而非

我认为有可能是一个可能的兼容DOS系统,其中有DOS间preTER但没有兼容的PowerShell或Perl ...我不知道一但并非完全不可能的。

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.

推荐答案

通常情况下,理由是,你需要的脚本不具有另一种间preTER并在其上是不允许的机器上运行安装一个跨preTER。在许多公司生产的服务器是一个很好的例子 - 你希望他们有尽可能少的开发载体成为可能,这意味着不需要对应用程序的功能没有任何的脚本语言

Typically, the rationale is that you need the script to run on a machine which does not have another interpreter and on which you are not allowed to install an interpreter. Production servers in many companies are a good example -- you want them to have as few exploitation vectors as possible, which means no scripting languages that are not required for application functionality.

您说的没错,当你说这个批处理语言是一个可怕的语言 - 有他们沉没的时间和资金投入到建设PowerShell的一个原因 - 但它也可以跨的无数版本依靠唯一的通用语言Windows操作系统。

You're right when you say that the batch language is a terrible language -- there's a reason they sunk the time and money into building PowerShell -- but it's also the only universal language you can rely on across the myriad versions of Windows.

这篇关于什么是Windows使用DOS批处理程序的原因是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆