Text File – Get rid of Multiple NUL Characters


Somehow I found myself with numerous NUL Characters in my text file; which coincidentally is a PowerShell Script (ps1) file.


Sample Contents

Here is what my file looks like:






Let us address using Notepad++

Review whether special symbols are being shown

Use menu items – “View” \ “Show Symbol”



Confirmed that we are not set to Show Special symbols; interpreted to mean this is the actual file contents.


Choose Search and Replace

  • Choose the menu items “Search” \ “Replace”
  • In the Replace Dialog do the following
    • In the “Find What” entry box, enter \x00
    • Make sure that the “Replace with” entry box is left empty
    • In the “Search Mode” group-box, select “Extended (\n, \r, , \x…)
    • Click on the “Replace All” button
  • Magically, all the  NUL-Character will be gone
  • Select the “Close” button to exit the “Replace” dialog





This problem really bugged me and had me thinking and listening to Monica:

Monica – Don’t take it personal(just one of them days)

  1. Video #1
  2. Video #2



Hopefully next time this befalls me, I will remember I burnt a few hours on it and was all morose, but was able to find a solution (at the end).

Obviously, stealing lines from “The Best Exotic Marigold Hotel.


The Best Exotic Marigold Hotel

“Everything will be alright in the end so if it is not alright it is not the end.”

“The only real failure is the failure to try, and the measure of success is how we cope with disappointment.”


Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s