Here’s a little Powershell tip that can be useful. If you have a directory with text files and want to add the content to a single text file, you can use this command in Powershell to read all text files in a folder.
Get-Content "directory path"\*.txt -Force
To add to this command, you can also add the content from the text files to a new text file using the below command:
Get-Content "directory path"\*.txt -Force | Set-Content "directory path"\results.txt
References
Related posts
- How to check if Powershell is running as an administrator
- How to use Powershell to bulk add users to groups in Active Directory
- Powershell UNC path browsing using PSDrives
- How to export an RSOP report using Powershell
Subscribe to newsletter:
If you want to receive the latest news for MEMCM, Windows 10, and Powershell, please subscribe to my monthly newsletter!
Thanks for your post ans is very helpful. I was able to copy all my text files into a single unit. Please just another bit that I will need your help on. I wanted to copy some part of individual files (from line 12 to the end) and copy all into a new file just like this one.