Revision: 40954
                            
                                                            
                                    
                                        
Initial Code
                                    
                                    
                                                            
                                    
                                        
Initial URL
                                    
                                    
                                
                                                            
                                    
                                        
Initial Description
                                    
                                    
                                                            
                                    
                                        
Initial Title
                                    
                                    
                                                            
                                    
                                        
Initial Tags
                                    
                                    
                                
                                                            
                                    
                                        
Initial Language
                                    
                                    
                                                    
                        at February 10, 2011 10:10 by bits
                            
                            Initial Code
for /f "tokens=1,2,3 delims=.: " %i in ('dir *.dll^|findstr /i "text"') do @echo %i %j %k
                                Initial URL
Initial Description
This example shows how you can split the output lines of e.g. a dir command. It also shows how to use a pipe to reduce the resulting lines by the findstr command. Explanation: This command calls "dir *.dll" and filters the results by findstr command through a pipe "|". The result of this is a list of all dll-files which contains the string "text" in it's name. Now the for-loop takes each of these lines and splits them by the signs given in the "delims=.: " part. The "tokens=1,2,3" will send the first three parts of the split string to the explicit defined variable %i and the implicit defined variables %j and %k. You can start counting your variables from every sign between a-z or A-Z. You will get more information about this on your command line with "for /?". If you want to use this in a batch file, replace all % with %%. This example will give you the date of alle found files in the format DD MM JJJJ (on a german windows box). If you use mor than three tokens or other characters as delims, you can get different results. Just play around.
Initial Title
Split output of dir command into parts
Initial Tags
Initial Language
DOS Batch