Scripting
You may be wondering why I’ve posted a blog on batch files (also known as command shell scripting). After all, it’s 2009 and the command-line is dead right? Not exactly. While PowerShell is Microsoft’s next iteration in their march towards command-line control of the interface, the traditional command-line that we have known since the days of DOS is still alive and well. And, if you are like me, you don’t want to learn something completely new just to run a few commands.
When should scripting be used? Well, that’s a personal decision, but I make this decision using the following criteria:
- Is this something that will be repeated or scheduled?
- How much time will it take to implement manually versus scripting?
With all of the scripting languages out there, how do I determine which one to use? Again, this is a personal decision that will be largely based on your knowledge of scripting languages. Beyond that, if you know multiple scripting languages, you will want to choose the one that will be easiest or fastest to write to get the output that you want. The reason you may want to use shell scripting is that it is both easy for simple scripts and you can make use of other command tools (resource kit, support tools or just built-in tools such as ping). Among the options to use are:
- Windows Scripting Host (languages: vbScript, jScript)
- Command shell scripting (batch files in the DOS-days)
- Other scripting languages that require an interpreter to be installed (PERL, PHP, Java, etc.) – in the Microsoft world, these will likely require you to install something first before you can run them; they are less useful in a “pinch” and users who are unfamiliar with programming, will likely find these more difficult to use
Whatever the language or option you are thinking of using, don’t get hung up on the “best” option. At the end of the day, the only important thing is the result – not how you got there. In other words, if you design a script that works, the underlying code is irrelevant.
- No comments yet.
- No trackbacks yet.
