Friday, June 1, 2018

POWERSHELL - Send output to file (with appending)

This example send first output to bothdirs.txt; second line with ">>" appends second output to end of file.
dir c:\tmp > c:\tmp\bothdirs.txt;
dir C:\Intel >> c:\tmp\bothdirs.txt;

notepad c:\tmp\bothdirs.txt;
Output:
Directory: C:\tmp

Mode                LastWriteTime     Length Name                                                                                                                        
----                -------------     ------ ----                                                                                                                        
d----       24. 5. 2018     11:05            png                                                                                                                         
-a---        1. 6. 2018     10:50          0 bothdirs.txt                                                                                                                
-a---       31. 5. 2018     13:54       8304 export.txt                                                                                                                  

    Directory: C:\Intel

Mode                LastWriteTime     Length Name                                                                                                                        
----                -------------     ------ ----                                                                                                                        
d----       14. 7. 2017     15:44            ExtremeGraphics                                                                                                             
d----       23. 5. 2018     12:47            gp                                                                                                                          
d----       14. 7. 2017     15:41            Logs                                                                                                                        

No comments:

Post a Comment