Deleting a nul File on Windows (The Clean Fix)
Upon trying to git status:
Deleting a nul File on Windows (The Clean Fix)
Upon trying to git status:
I found this horrible guy “nul”

I could not delete him.

Even handle could not find him.

This one was painful.
On Windows, nul is a reserved DOS device name, which means:
- Explorer cannot delete it
- PowerShell cannot delete it
del nulfailshandle.exeshows no process locking it
Even though the file clearly exists.

The key insight
The problem is not a lock. It is a Windows namespace limitation.
NTFS allows a file called nul.
Win32 tools refuse to touch it.
The solution that actually works
Use WSL, which does not have DOS device names.
Steps (worked instantly)
Open Command Prompt as Administrator
Start WSL:
wsl
Navigate to the Windows drive via /mnt:
cd /mnt/c/ROSCODE\ TECH/Skinvest/skinvest
- Delete the file normally:
rm nul
That is it.
Exit WSL, go back to Windows, and the file is gone.
Why this works
- WSL talks to NTFS directly
- Linux has no concept of
nul,con,aux, etc. - The file was never locked, just unreachable from Win32
Prevent this in future (important)
If this came from Git, run once:
git config --global core.protectNTFS true
This stops nul, aux, con, and similar files from ever being created again on Windows.
Final takeaway
If Windows cannot delete a file named nul and no process is locking it, stop fighting Win32.
Drop into WSL and remove it like a normal file.
메타데이터
- post_id
- 7e664c58bb30
- slug
- deleting-a-nul-file-on-windows-the-clean-fix-7e664c58bb30
- url
- https://medium.com/@roscoe.kerby/deleting-a-nul-file-on-windows-the-clean-fix-7e664c58bb30
- canonical_url
- https://medium.com/@roscoe.kerby/deleting-a-nul-file-on-windows-the-clean-fix-7e664c58bb30
- author_url
- https://medium.com/@roscoe.kerby
- status
- ok
- fetched_at
- 2026-07-14 14:55:07