home bbs files messages ]

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

   alt.msdos.batch      Fun with MS-DOS batch files      42,547 messages   

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

   Message 41,615 of 42,547   
   Grant Taylor to Climate Hillbilly Davis   
   Re: Rename One File In Batch To It's Mod   
   06 Jan 18 21:56:39   
   
   XPost: alt.comp.editors.batch, alt.msdos.batch.nt   
   From: gtaylor@tnetconsulting.net   
      
   On 01/06/2018 09:45 PM, Climate Hillbilly Davis wrote:   
   > It's not a deal at all. The batch file is small to begin with.   
      
   *nod*  That's what I figured.  But based on your previous comment,   
   "…took about 500 more characters…" I thought you might be trying to be   
   as small as possible.   
      
   > I've got @echo off, spaces and cls's and moves and program starts,   
   > and it's only 494 bytes.   
      
   Based on my tests (that I've since removed) I think I was coming in at   
   ~127 B compared to 158 B.  So, a non-trivial percentage, …if you are   
   chasing every byte possible.  ;-)   
      
   > That worked fine too. Thanks.   
      
   You're welcome.   
      
   > No space in the extension, so all is well.   
      
   *nod*   
      
   > I'm not sending a parameter, so I just changed the %1 to the name of   
   > the file that I produce later in the batch file.   
      
   You might be able to refactor things to remove the conditional and just   
   call the for loop directly.   
      
   > One question, though... what is the %~1? I also put the name of the file   
   > there and it still works. What is the difference in %1 and %~1?   
      
   Based on a quick skim of the output of "for /?", it looks like the tilde   
   without any letter between it and the variable name removes surrounding   
   quotes.   
      
   So I think the idea is to remove the quotes if they exist, and to   
   manually put them there.  Thus avoiding a double quoting issue.   
      
   > Thanks again.   
      
   You're welcome.   
      
      
      
   --   
   Grant. . . .   
   unix || die   
      
   --- 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