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,424 of 68,980   
   Zaidy036 to Herbert Kleebauer   
   Re: Replace line in a txt file with miss   
   10 Jan 24 21:09:14   
   
   From: Zaidy036@air.isp.spam   
      
   On 1/10/2024 6:41 PM, Herbert Kleebauer wrote:   
   > On 10.01.2024 21:59, Zaidy036 wrote:   
   >   
   >> I simplified by removal of %_NN% and:   
   >> - This current last one liner crashes the batch:   
   >> FOR /F "USEBACKQ TOKENS=1,2 DELIMS=:" %%A IN ("F:\_NW-B.txt") DO (IF   
   >> "%B"==" " ECHO %%A >> F:\_NW-N.txt)   
   >   
   > Move "IF" to the next line, double the % and remove the space from   
   > "%B"==" "   
   >   
   > FOR /F "USEBACKQ TOKENS=1,2 DELIMS=:" %%A IN ("F:\_NW-B.txt") DO (   
   > IF "%%B"=="" ECHO %%A >> F:\_NW-N.txt)   
   >   
   >   
   > But why do you use USEBACKQ?   
   Because my experience if runs in Admin-CMD will also run in batch. Tried   
   without usebackq and errors.   
      
   "%B"==" " space required can see when run with ...DO (ECHO "%A" "%B")   
      
   Moving to second line does not work in Admin-CMD and only benefit is   
   shorter lines in the script.   
      
   As a further test I ran only that one command in both ADMIN and nonADMIN   
   Batches and they also crashed,   
      
   Did you test your suggestions in Admin-CMD?   
      
   Why does it work in Admin-CMD BUT not in a batch?   
      
   --- 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