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,034 of 68,980   
   Adam Lubszczyk to All   
   Re: Set an environment variable YWD to c   
   12 Apr 23 03:58:34   
   
   From: adam_l@poczta.onet.pl   
      
   środa, 12 kwietnia 2023 o 12:24:35 UTC+2 John Stockton napisał(a):   
   > On Wednesday, 12 April 2023 at 02:50:14 UTC+1, JJ wrote:    
   > > On Tue, 11 Apr 2023 15:16:54 -0700 (PDT), John Stockton wrote:    
   > > >    
   > > > But it must be nicer to do it in pure Batch - how?    
   > > Are those character code numbers in hexadecimal or in decimal?   
   > They are decimal, but not character code. That means from the 20th character   
   to the 29th character (there is a "W", 2 "-", and 7 digits).   
   > > > I can set an environment variable YWD to characters 20-29 of a one-line    
   > > > file, ending CRLF, using an ancient utility COLS, written by me.   
   > My COLS is a fairly simple stream editor, reading lines from Standard Input,   
   processing each in turn, and writing them to Standard Output. Its arguments   
   include strings and position indication.    
   > So I just use it to edit the input line to a SET YWD=?????????? line,   
   redirect the output to a new file, call that file, and delete it.    
   >    
   > COLS was written in 16-bit Borland Pascal, probably version 7, last edited &   
   compiled 2005-10-29, and recompiled in Delphi 3 on 2009-02-10 to get the   
   current 32-bit EXE file.   
   > --    
   > (c) John Stockton, near London, UK. Using Google Groups. |   
      
   @ECHO OFF   
   FOR /F "tokens=*" %%a IN (file_name.txt) Do CALL :label1 "%%a"   
   EXIT   
      
   :label1   
   REM  ~ delete "   
   SET YWD=%~1   
   REM Substr 9 chars begin 20 (offset 19)   
   SET YWD=%YWD:~19,9%   
   ECHO %YWD%   
   REM ...   
   GOTO :EOF   
      
      
   Adam   
      
   --- 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