0

I have PowerShell 4.0. My question is that have 10 folders and each folders contain 300 text files. Out of 300 text files, there are almost 150 files that are empty but have unique special character. I open each of the file with Notepad++ and the character is "EXTNULL". I open with Notepad and the character is like "L". I can't load them because of that.

How could I remove the special characters using PowerShell 4.0?

The folders are like this:

C:/temp/file1_extracted
c:/temp/file2_extracted
c:/temp/file3_extracted
...
c:/temp/file10_extracted
This Format-Hex is working in Powershell 5.0 and above but I have 4.0
Get-Content -path "C:\temp\file1_extracted\file1.txt" | Format-Hex

Here is the symbol for the special characters:
Offset Bytes  Path
------ ----- ----
0 {3, 0} 
serob
  • 5
  • 1
  • 6
  • Look at https://stackoverflow.com/a/52648684/45375 to determine what those characters actually are, and how they can be described in general terms. – mklement0 Nov 12 '18 at 03:20
  • If this isn't encoding problem but the file really has control characters, consider [binary mode editing](https://stackoverflow.com/q/20935356/503046). – vonPryz Nov 12 '18 at 06:54
  • 2
    Please [edit] your question and show the output of `Get-Content FILE | Format-Hex` for one of the files. – Ansgar Wiechers Nov 12 '18 at 09:40
  • I edit my question and show the output of Get-Content File | Format-Hex. Could anyone help me? – serob Nov 13 '18 at 22:22

0 Answers0