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 68,017 of 68,980   
   Auric__ to Harry Potter   
   Re: Bulk copy with changed extension   
   08 Mar 23 23:41:26   
   
   From: not.my.real@email.address   
      
   Harry Potter wrote:   
      
   > __Auric: I see two bugs in your batch file.  The first line should read:   
   >   
   > if "%%1"=="" goto end   
      
   Pretty much anything would also work here -- I normally have '%1==' in my   
   batches, not the oopsie I originally posted. As I said, I'm out of practice.   
      
   > Then you have to end with:   
   >   
   >:end   
   > pause   
   >   
   > The pause is only necessary if you want to read the batch file's output.   
      
   It's funny. Lately I've been using certain programming languages that do in   
   fact have an "end" keyword; that's what threw me off. Batches in fact have   
   :EOF instead. (On NT systems, anyway; can't remember about 9x or DOS but it   
   wouldn't surprise me if the answer was "no.")   
      
   Also, pause would only necessary if run from the GUI; when run from the   
   terminal it shouldn't be.   
      
   The corrected batch is:   
      
     if '%1==' goto :EOF   
     cd /D "%1"   
     copy *.ino *.txt   
     for /d /r %%a in (*) do (   
     cd "%%a"   
     copy *.ino *.txt )   
      
   The original botched version worked for me, so I had no reason to test   
   things like "no arguments passed." (As I said, I did the whole thing in 30   
   seconds.)   
      
   --   
   I have subscribed to this theory for some time.   
      
   --- 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