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,437 of 68,980   
   Zaidy036 to Herbert Kleebauer   
   Re: Replace line in a txt file with miss   
   11 Jan 24 14:03:59   
   
   From: Zaidy036@air.isp.spam   
      
   On 1/11/2024 11:31 AM, Herbert Kleebauer wrote:   
   > On 11.01.2024 17:03, Zaidy036 wrote:   
   >> On 1/11/2024 10:30 AM, Herbert Kleebauer wrote:   
   >>> On 11.01.2024 16:09, Zaidy036 wrote:   
   >>>   
   >>>> Batch window closed and _NW-N.txt not generated.   
   >>>   
   >>> Did you start the batch with a double click in explorer?   
   >>> Then insert a pause at the end of the batch to see the   
   >>> error message. Or better start the batch within an open   
   >>> CMD window   
   >>>   
   >>> If you started the batch within an opened CMD window   
   >>> and the CMD window is closed when you execute the batch,   
   >>> then you have a seriously problem. In this case simplify   
   >>> the batch code until it doesn't crash and then add   
   >>> code until you find the critical part of the code.   
   >>>   
   >>>   
   >> basically that is what I did and the addition of the cmd shown closes   
   >> the batch window but when run with an open cmd window and NOT by batch   
   >> it works correctly   
   >   
   > You still didn't said how you start the batch.   
   >   
   > Open a cmd window. CD to the directory where the batch   
   > is stored. Name your batch test.bat so there is no name conflict   
   > with a program with the same name and type test.bat to   
   > execute the batch. Then you should see the error messages.   
   >   
   >   
   >   
   When I must frequently test a batch as I develop it I add an icon to the   
   desktop. In this case it is set to run as administrator and produces the   
   same results as running from the actual file location.   
      
   For the tests I have my normal @ECHO OFF rem'd out so errors should show   
   and I have a PAUSE as the cmd before the one in question.   
      
   I ran three tests and it appears that {IF "%B"==" "} is the problem   
   because the first two tests crash. Note that the last shows %B is " " is   
   the value when the name does not exist.   
      
   FOR /F "USEBACKQ TOKENS=1,2 DELIMS=:" %%A IN ("F:\_NW-B.txt") DO (   
   IF "%B"==" " ECHO %%A >> F:\_NW-N.txt)   
      
   FOR /F "USEBACKQ TOKENS=1,2 DELIMS=:" %%A IN ("F:\_NW-B.txt") DO (IF   
   "%B"==" " ECHO "%%A"  "%%B")   
      
   FOR /F "USEBACKQ TOKENS=1,2 DELIMS=:" %%A IN ("F:\_NW-B.txt") DO (ECHO   
   "%%A"  "%%B")   
      
   If you are willing run the last cmd against your input file and see if   
   your "%B" is "" or " ". If "" could you add spaces where the names are   
   blank and retest?   
      
   The purpose of the batch is to collect Wi-Fi SSIDs that my system sees   
   and make a list of those I have passwords for. All works OK except when   
   an SSID has no name and the following cmds delete that SSID and replace   
   it with the same SSID with a dummy name. I tested by manually adding   
   names in _NW-B.txt and the present problem is all that remains to solve.   
      
   --- 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