ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

Main Area and Open Discussion > General Software Discussion

DOS Batch Functions Tutorial

(1/6) > >>

justice:
As part of the development of an app, I'm doing the build process using the batch file. I might write a bit more about this at a later date. As the batch file grew I was wondering if it could do functions, to avoid using the same code multiple times. This page is a really good resource (http://www.dostips.com/DtTutoFunctions.php):





Renegade:
You might want to look into PowerShell as it has largely replaced batch files for a lot of admins.

But, batch files do have their appeal still! (I use some batch commands in build processes and whatnot.) Those look like some nice tuts! :)

daddydave:
See https://www.donationcoder.com/forum/index.php?topic=22441.0

EDIT: Sorry the above link was a bit off topic. You didn't really ask for other batch file resources, did you? I will check out the link you gave. It's very handy to be able to use functions in batch files. :Thmbsup:

One big advantage of batch files is you don't have to install anything, so you can use them in restricted environments (i.e., work).

IainB:
IMHO, the best thing to do with DOS batch commands is avoid using them.
Try Take Command from JP Software.
I used to use the precursor to Take Command, called 4DOS. It was superb. I gather from Wikipedia that 4DOS is pseudo public domain now.

mwb1100:
One big advantage of batch files is you don't have to install anything, so you can use them in restricted environments (i.e., work).
-daddydave (June 16, 2011, 11:13 AM)
--- End quote ---

That's the only advantage.  But it's a compelling one.

The book "Windows NT Shell Scripting" by Timothy Hill has about the best coverage of how to do complex processing with batch files that I've come across (get a used/remaindered one for the cost of shipping).

But I'd avoid doing anything too complex with batch files unless you really, really have to.  There are so many far better tools available (and most of them free).  But you do usually have to make sure they're installed (or that a runtime is) if the script you're coming up with has to be able to run on machines you don't control.

AutoHotKey (and friends) is one of the exceptions as I understand it - build the script to an exe and nothing else is needed on the end-user's machine (I imagine that's one of the reasons it's quite popular on DC's coding snacks).

Navigation

[0] Message Index

[#] Next page

Go to full version