home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   alt.msdos.batch.nt      Fun with Windows NT batch files      68,980 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 67,912 of 68,980   
   Auric__ to John   
   Re: batch file structure   
   05 Jul 22 22:00:37   
   
   From: not.my.real@email.address   
      
   Kerr-Mudd, John wrote:   
      
   > On Tue, 5 Jul 2022 16:43:35 -0000 (UTC)   
   > "Auric__"  wrote:   
   >   
   >> Dallas wrote:   
   >>   
   >> > When you code a batch file do you have patterns that help when you   
   >> > compose them?   
   >> >   
   >> > For example I always start off a batch file with a line in the form   
   >> >   
   >> > @echo off % mybatchfilename.bat %   
   >> >   
   >> > Note the spaces after the first % and before the final % character.   
   >> > I put those there just to make sure I don't accidentally match an   
   >> > actual variable name.   
   >> >   
   >> > That way the content of the batch file carries the name of the batch   
   >> > file.   
   >> >   
   >> > I am curious if anyone has things like that that help you compose   
   >> > batch files.   
   >>   
   >> Not batch files, no. I have a template that I use for the README of my   
   >> projects, but nothing for anything scripting- or programming-related.   
   >> The majority of my batch files tend to be one-liners anyway.   
   >>   
   > Mostly self-documented with a 'help' section   
   >   
   > rem {insert datestamp}   
   > if \%1==\ goto Usage   
   > ...   
   >   
   >   
   >   
   > ...   
   > goto end   
   > Usage:   
   > echo %0 is a program to ...   
   > echo Usage is %0 parm1 parm2 {parm3}   
   > echo e.g. %0 x y does action   
   > rem relies on (dependency) being accessible via path   
      
   My batches that I use to compress files have help sections, but seeing how   
   each batch was based on the previous batch (they're named 1z.cmd, 2z.cmd,   
   etc.) I really only wrote that section once and then modify it as needed for   
   whatever changes I make.   
      
   --   
   Because in the end, does it really matter?   
   And why let the truth get in the way of a good story?   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca