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,757 of 68,980   
   John Stockton to All   
   String case conversion in Batch   
   21 Aug 21 05:15:13   
   
   From: dr.j.r.stockton@gmail.com   
      
   I enter "z filename" on lower case on the Command Line, and there should be a   
   file "FILENAME.TXT" for "Z.BAT" to use - OK so far.   
      
   But I want to use "FILENAME", not "filename", within the Batch file, so that   
   files created by the Batch have using the case of the first part of the .TXT   
   file.   
      
   I do this with   
      
   :: Copy %1 as FILENAME case into %ZQ%   
   @dir /b %1.TXT | COLS '@SET * 'ZQ= 1-8 > ZQ.BAT & call ZQ.BAT & del ZQ.BAT   
      
   in which COLS.EXE is something I wrote long ago (' starts a space-less string,   
   * gives a space, 1-8 gives that range of the piped input].  %1 is not used   
   after that; %ZQ% is used instead.   
      
   Is there a better way of doing it, preferably in pure Batch - I know I could   
   use MiniTrue instead?   
      
   The above relies on the case of "FILENAME", which is best for me; but, for   
   interest, could one force upper-case?   
      
   --   
     (c) John Stockton, near London, UK.  Using Google Groups.           |   
    Mail: J.R.""""""""@physics.org - or as Reply-To, if any.             |   
      
   --- 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