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,426 of 68,980   
   Tom Del Rosso to All   
   Output redirecting and piping   
   16 Jun 19 11:17:48   
   
   From: fizzbintuesday@that-google-mail-domain.com   
      
   tasklist | sort >file.txt   
      
   The above puts sort.exe in the output file.  I would have expected SORT   
   to run after TASKLIST terminates.  The old DOS piping method was to use   
   a temporary file, but I suppose Windows does not do it that way.  Is   
   there an explanation for that?   
      
   This is really just a trivial aside question raised when I looked into   
   another problem in which FIND sometimes fails to see an image name in   
   the output of TASKLIST.   
      
   But that's not a problem any more because I can fix it by adding SORT to   
   the pipe as follows:   
      
   tasklist | find /i "firefox.exe"   
   sometimes outputs nothing even though is is there, and misses a lot of   
   other lines too, but   
      
   tasklist | sort | find /i "firefox.exe"   
   always sees anything specified in the list, from top to bottom.   
      
   Of course TASKLIST has filters but it doesn't return an exist code so   
   FIND is necessary for that.   
      
   The lines it misses are mingled with lines it sees, so it is not because   
   they are at the bottom and SORT re-orders them.   
      
   I thought maybe TASKLIST was outputting mis-matched CR and LF the way   
   IPCONFIG does, but that's not it.   
      
   And FINDSTR does the same thing.   
      
   Weird but not a problem if SORT keeps fixing it.   
      
   --   
      
   --- 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