Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Problem: There are generally many examples of using batch (and bash) scripts in DOS shell to automate various programs. But I have found few resources that suggest ways to manage all the batch files that can compile in a project, or over the years. (Or perhaps I have just been using the wrong keywords for searching).

Background: I have never actually attempted to really organize batch files I've made so that they can easily be reused. Currently I have various bat files in folders that I modify with txt editor (if I can manage to put them in a place that I can later remember). Before I put effort into a type of organization structure, I want to ask if I am thinking about the problem/potential solution most effectively.

Best general solution?: The general approach I can think of is modifying all batch files to accept parameters, and then creating interfaces that ask for parameters using either "higher-level" batch files, or creating a GUI that then passes parameters to certain batch files.

Question: Is this approach considered the most common/efficient for batch file organization, or are there some valid alternatives or additions to the approach that would be "better practice" (involving software that automates the process/other ways of organizing batch files for reusability/...)

share|improve this question
    
I just put all my batch files in a folder that is in my path, then I can call them as needed. I try to always make sure to include help information (via /?, -h, etc. or when called with no arguments) because I often forget the parameters if I haven’t used them in a while. Also, I try to use a consistent format for my batch files (e.g., skeleton, standard labels, argument checking code, etc.) Comments also help. –  Synetech Jul 25 '12 at 3:04
add comment

1 Answer

For me, step one would be documentation...both with internal comments in the files and externally maybe via a wiki or some other KM tool so that others can decipher your work.

Second would be to make sure you have some version control (tortoise SVN or similar)... Documenting your commits as much as possible.

Organization... Grouping batch files by process or function including common naming conventions if possible.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.