windows 学习控制台命令的重要性
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3931450/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Importance of learning console commands
提问by hrzafer
I'm teaching an introductory class to brand new computer engineering students. This week I'm going to teach basic Windows console (command prompt) commands and batch files (and a few weeks later unix). Last year some students were whining that "it wasn't necessary anymore". Since I insist on teaching it, I have some reasons in mind. But I'd like hear you guys' opinions. What reasons can I use to convince them before I start?
我正在为全新的计算机工程专业学生教授一门入门课程。本周我将教授基本的 Windows 控制台(命令提示符)命令和批处理文件(以及几周后的 unix)。去年,一些学生抱怨说“没有必要了”。既然我坚持教它,我心里有一些原因。但我想听听你们的意见。在我开始之前,我可以用什么理由来说服他们?
thanks.
谢谢。
Ok, after several answers now I'd like list my reasons to teach basic console commands and basic batch file usage.
好的,现在经过几个答案,我想列出我教授基本控制台命令和基本批处理文件使用的原因。
- First of all it helps to understand how things are happening behind the scenes. This will be useful with many courses in the future such as OS and Network.
- A good start before learning Linux. Then, why not Linux first? Because most of them have never used anything else except Windows yet. (A few weeks later I'll teach Linux and virtual box)
- Do not underestimate batch files. This is also a good introduction for UNIX shell scripts.
- They are also learning C programming on Windows. So they can use some commands with system(); function in their code.
- For the rest of their life in a way they will have to perform many tasks without using GUI.
- 首先,它有助于了解幕后发生的事情。这将在未来的许多课程中有用,例如操作系统和网络。
- 学习 Linux 之前的良好开端。那么,为什么不先使用Linux呢?因为他们中的大多数人除了 Windows 之外从未使用过其他任何东西。(几周后我会教 Linux 和 virtual box)
- 不要低估批处理文件。这也是 UNIX shell 脚本的一个很好的介绍。
- 他们还在 Windows 上学习 C 编程。所以他们可以在 system() 中使用一些命令;在他们的代码中发挥作用。
- 在他们的余生中,他们将不得不在不使用 GUI 的情况下执行许多任务。
Edit: In the original question by MS-DOS what I was trying to say is Windows command prompt and command line in general.
编辑:在 MS-DOS 的原始问题中,我想说的是 Windows 命令提示符和命令行。
回答by Alberto Zaccagni
Will this be something they will use? If not they will probably forget about it, or learn it without knowing why, maybe hating it, and that you don't want.
这会是他们会使用的东西吗?如果不是,他们可能会忘记它,或者在不知道为什么的情况下学习它,也许讨厌它,而且你不想要。
I think they will end up using powershell (if not a *nix shell), so why not teach that?
我认为他们最终会使用 powershell(如果不是 *nix shell),那么为什么不教呢?
回答by Pekka
There are good reasons for learning working with the command line - it is so much faster than any GUI for so many tasks - but DOS really doeshave a distinctly antiquated air to it. That's not to say it isantiquated - cmd
still ships with every Windows for good reasons - but students need the feeling they are learning something new and cool.
有充分的理由为学习使用命令行工作-这是比任何GUI这么多的任务更快-但DOS真的确实有一个明显的过时的空气吧。这并不是说这是过时的-cmd
仍然附带每个Windows有很好的理由-但学生需要他们正在学习新的东西,冷静的感觉。
I would focus on Linux for teaching the command line - nobody can say that's not relevant in 2010! - and deal with the DOS shell and its (more limited) possibilities and differences as a part of that.
我会专注于 Linux 来教授命令行 - 没有人可以说这与 2010 年无关!- 并处理 DOS shell 及其(更有限的)可能性和差异作为其中的一部分。
回答by Francis Niu
As phalacee above said: "MS-DOS doesn't exist in modern Windows". The Command Prompt in Win2K/WinXP/Win2003 is different with original MS-DOS. I think MS-DOS is almost (if not absolutely) antiquated and unworthy to learn, unless for someone who wants to understand the Microsoft OS evolution path.
正如上面的 phalacee 所说:“现代 Windows 中不存在 MS-DOS”。Win2K/WinXP/Win2003 中的命令提示符与原来的 MS-DOS 不同。我认为 MS-DOS 几乎(如果不是绝对的话)过时且不值得学习,除非对于想要了解 Microsoft 操作系统发展路径的人。
However, for Windows users, the cmdstill should be learnt. Following are the reasons in my opinion:
不过对于Windows用户来说,cmd还是要学的。以下是我认为的原因:
- Command Prompt is the basic CLI shell on Windows. Many utilities (e.g. ipconfig/ping/netstat/sqlcmd for SQLServer, etc) can only be used in command line.
- Batch(.bat) or CMD(.cmd) script is useful to lots of simple automatic jobs -- although its functionality and syntax are both unly.
- Some additional toolkits can be used to enhance the ability of cmd, such as Cygwin, Sysinternals, Windows Resource Kit Tools, etc. They need knowledge on cmd.
- 命令提示符是 Windows 上的基本 CLI shell。许多实用程序(例如,用于 SQLServer 的 ipconfig/ping/netstat/sqlcmd 等)只能在命令行中使用。
- Batch(.bat) 或 CMD(.cmd) 脚本对许多简单的自动作业很有用——尽管它的功能和语法都是不统一的。
- 可以使用一些额外的工具包来增强 cmd 的能力,例如 Cygwin、Sysinternals、Windows Resource Kit Tools 等,它们需要有关 cmd 的知识。
The section 15 (Tip 21) in the famous book The Pragmatic Programmerexplained why command line should be learnt.
著名的The Pragmatic Programmer一书中的第 15 节(提示 21)解释了为什么应该学习命令行。
On Windows 7, PowerShellseem to be a better choice than cmd.
在 Windows 7 上,PowerShell似乎是比 cmd 更好的选择。
回答by jsnfwlr
First, MS DOS doesn't exist in modern windows - it hasn't since Win2k/WinXP What you mean in the Windows Command Line. There are a number of great uses for it, but you may find it easier to teach them to create .cmd scripts and run them from the "Run" dialog.
首先,现代 Windows 中不存在 MS DOS - 从 Win2k/WinXP 开始就不存在 Windows 命令行中的意思。它有许多很好的用途,但您可能会发现教他们创建 .cmd 脚本并从“运行”对话框中运行它们更容易。
my reasons for using the command line in windows are as follows:
我在windows中使用命令行的原因如下:
- ipconfig /flushdns
- ping
- ipconfig /flushdns
- 平
Aside from that, I rarely use the command line in windows. If I need to do anything in a batch process, I'll ssh into my linux server and do that.
除此之外,我很少在 Windows 中使用命令行。如果我需要在批处理中执行任何操作,我将通过 ssh 连接到我的 linux 服务器并执行此操作。
Powershell may be better, but I don't use that (as I said, I have linux available to me) so I can't comment on that really.
Powershell 可能更好,但我不使用它(正如我所说,我有可用的 linux)所以我无法对此发表评论。
回答by Carles Company
In windows you could also teach them Powershell...
在 Windows 中,您还可以教他们 Powershell...
回答by mouviciel
- Considering that more and more computers (including mobile phones and servers in data-centers) are based on Unix or Linux,
- Considering that the core of your class is Unix and Linux,
Considering that Cygwin gives access to Unix command line on Windows,
But considering also that MS-DOS may sometimes help,
- 考虑到越来越多的计算机(包括手机和数据中心的服务器)基于 Unix 或 Linux,
- 考虑到你们班的核心是Unix和Linux,
考虑到 Cygwin 可以在 Windows 上访问 Unix 命令行,
但考虑到 MS-DOS 有时可能会有所帮助,
I would teach the other way: Unix as a starter and a main course, then MS-DOS as a side note.
我会以另一种方式教授:Unix 作为入门和主要课程,然后 MS-DOS 作为旁注。
回答by Daniel Snowden
Never underestimate how useful batch files can be. Around a year ago I used to use them for several little tasks such as automatically copying backup files over a network. They can be very useful.
永远不要低估批处理文件的用处。大约一年前,我曾经将它们用于一些小任务,例如通过网络自动复制备份文件。它们非常有用。
回答by ghostdog74
Here's some reason why you should drop the idea of teach DOS (cmd.exe
) in this present era.
这就是为什么cmd.exe
在这个时代你应该放弃教 DOS ( )的想法的一些原因。
- Lack of data structures such as arrays/dictionaries/hashes.
- Lack of String/text manipulation functions and capabilities.
- Lack of Date arithmetic capabilities
- Lack of maths capabilities. only able to do maths on integers.
- Lack of other programming constructs like while loop, etc
- Because of lack of such features, one usually has to create workarounds, so much so that the batch code ends up messy and inefficient.
- and many others etc
- 缺少数组/字典/哈希等数据结构。
- 缺乏字符串/文本操作功能和能力。
- 缺乏日期算术能力
- 缺乏数学能力。只能对整数进行数学运算。
- 缺乏其他编程结构,如 while 循环等
- 由于缺乏这样的功能,人们通常不得不创建解决方法,以至于批处理代码最终变得混乱和低效。
- 和许多其他人等
Some better alternatives,
一些更好的选择,
- Linux shell.
- vbscript
- powershell
- C
- Python.
- Linux外壳。
- 脚本
- 电源外壳
- C
- Python。
回答by Andrei Bularca
Maybe one day your windows will crush so if you know the basics of MS-DOC you can save some files from your computer before you format your disk. Or maybe you can fix your hard drive. If your are a developer you can use MS-DOC commands to generate some file... Is very helpful in some cases.
也许有一天你的 Windows 会崩溃,所以如果你了解 MS-DOC 的基础知识,你可以在格式化磁盘之前从计算机中保存一些文件。或者,也许您可以修复硬盘驱动器。如果您是开发人员,您可以使用 MS-DOC 命令生成一些文件...在某些情况下非常有用。
回答by kyndigs
Learning anything is useful, however I wouldnt enforce it on them, there are a lot of great command line tools still available for use, and sometimes its simpler to write a simple batch file to do some tedious tasks. DOS isnt exactly a hard thing to learn so I wouldnt spend much time on it but simply teach some fundamental DOS commands and point them to some references where if they wish to further their knowledge then they can.
学习任何东西都是有用的,但是我不会对它们强制执行,有很多很棒的命令行工具仍然可以使用,有时编写一个简单的批处理文件来完成一些乏味的任务会更简单。DOS 并不是一件很难学习的事情,所以我不会花太多时间在它上面,而是简单地教授一些基本的 DOS 命令,并将它们指向一些参考资料,如果他们希望进一步了解他们,那么他们可以。