如何使用PowerShell删除文本文件中的前3个符号并保持文件名称相同?
Just read the file using the Get-Content
cmdlet, remove the file using a regex that replaces the first three characters with nothing and finally write it back using the Set-Content
cmdlet:
(Get-Content 'yourfilePath.txt' -raw) -replace '^...' | Set-Content 'yourfilePath.txt'
Note: You probably want to specify the encoding using the -Encoding
parameter when writing the content back to the file.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.