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,410 of 68,980    |
|    Zaidy036 to All    |
|    Re: Replace line in a txt file with miss    |
|    09 Jan 24 22:23:02    |
   
   From: Zaidy036@air.isp.spam   
      
   On 1/8/2024 8:21 PM, JJ wrote:   
   > On Mon, 8 Jan 2024 13:15:54 -0500, Zaidy036 wrote:   
   >> Sorry, did not mean to cause further confusion.   
   >>   
   >> _JJ (total entries in list) and _NN (multi-run counter) are set before   
   >>   
   >> SET /A _X=0   
   >> :_RepeatX   
   >> SET /A _X=%_X% + 1   
   >> FOR /D %%S IN ("Guest" "Residents" "ResidentsA" "Residents 5") DO (   
   >> FINDSTR /C:"SSID %_X% : %%~S" F:\_%_NN%NetworkB.txt >> F:\_%_NN%NetworkL.txt   
   >> )   
   >> IF NOT %_X%==%_JJ% && GOTO _RepeatX   
   >>   
   >> (removed "FOR /L" to simplify for test)   
   >>   
   >> "usebackq tokens" is what I am missing so thanks for bringing to my   
   >> attention. I will learn about applying it for the above or for making   
   >> F:\_%_NN%NetworkB.txt   
   >   
   > Also initialize the _JJ variable. Don't leave it empty/unassigned.   
   > Initialize it with 0.   
      
   Of course just look at second line starting with _JJ   
      
   I have a problem I cannot solve:   
      
   ---This one line in an Admin CMD window works:   
   FOR /F "TOKENS=1,2 DELIMS=:" %A IN (F:\_%_NN%NW-B.txt) DO (IF "%B"==" "   
   ECHO %A >> F:\_%_NN%NW-N.txt)   
      
   ---In a batch running as Admin using %% the batch crashes:   
   FOR /F "USEBACKQ TOKENS=1,2 DELIMS=:" %%A IN ("F:\_%_NN%NW-B.txt") DO   
   (IF "%B"==" " ECHO %%A >> F:\_%_NN%NW-N.txt)   
      
   How do I make the batch work?   
      
   --- 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