Best free resource to learn about extended batch file usage?

What are the best free resources for learning an extended batch file?

+7
build-automation dos batch-file automated-tests
Oct 07 '08 at
source share
6 answers

It's not free, but it's probably the best. "Windows NT Shell Scripting" by Tim Hill .

However, whenever I try to do something โ€œadvancedโ€ in cmd batch files, I always regret it.

Always.

edit: some explanation of the disadvantages of batch files:

  • Mathematical possibilities are pathetic
  • support for citation is an afterthought - if you need to pass a quoted string as an argument to a command that needs to be quoted itself, reserve a place in the shelter (in fact, I'm not sure if this is possible)
  • string manipulation is a patchwork with half the functionality implemented

Then there are seemingly endless bits of oddities, angular cases and inconsistencies that you encounter at every turn.

The only thing that happens with batch files is the support for each Windows window. If you just want to automate the execution of several commands in a group, great. Perhaps add a simple loop, a couple of routines, and some environment variables to parameterize things. In addition, I highly recommend that you use something else.

+16
Oct 07 '08 at 22:59
source share

Also consider learning Windows Scripting Host as an alternative to batch scripting. You can use your own language for writing scripts (JScript, VBScript, even Python). It is supported by any modern version of Windows and provides a multifunctional library of functions that makes batch files primitive in comparison.

What am I saying? Windows ARE batch files.

You can also create reusable WSH libraries, modules, etc. There was a little learning curve compared to batch files, but it's worth it. My Linux friends no longer need to make fun of my low scripting environment. Now they just make fun of my lower OS.

+4
Oct 07 '08 at 23:32
source share

To get help on the commands, this .bat file will put the whole command in a good HTML page: http://www.robvanderwoude.com/files/allhelp.zip

This guy has other interesting .bat stuff. http://www.robvanderwoude.com/batexamples_a.html

+4
Oct 08 '08 at 7:17
source share
+3
07 Oct '08 at 22:56
source share

I found this to be useful: http://www.ss64.com/ntsyntax/

+3
Oct 07 '08 at
source share

Perhaps a stack overflow?

stack overflow

What I found useful was to save all the help built into cmd.exe in files. In cmd.exe, enter "help", which will show you a large list of commands for which you can get help for each of these types of "help <command>", and then save the results to files with the corresponding name. Personally, Iโ€™m much more comfortable reading the help information in the form of a file.

In addition, I strongly agree with Mike B.'s ban on too many batch files. It is almost always better to use a more reliable language than a package for any task that is not trivial. If your batch file is longer than the page length when printing, you almost certainly live to regret it.

+3
07 Oct '08 at 23:04
source share



All Articles