Remove 4 Lines from the start of every text file

A simple little command

“c:\temp\FilesIn” is the location of the files to process

“c:\temp\FilesOut\” is the location of the files created with the first 4 lines removed

if you want to remove just  1 line replace the code with  -Skip 1

Copy and paste the following line into a powershell command prompt (watch for the word wrap in the blog)


get-childitem -path "c:\temp\FilesIn" | foreach-object {$outfile = ("c:\temp\FilesOut\" + $ ; Get-Content $_.fullname | select -Skip 4| set-content $outfile }


Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.