The mysterious NUL file problem
AI tools sometimes create nul files that you can’t delete normally. Here’s how to fix it.
The problem
Some AI tools (Cursor, Copilot, and similar) accidentally create files named nul, which is a reserved name in Windows. That makes them impossible to delete with File Explorer or a normal del.
You’ll see errors — and the file stays put.
Git won’t push it
Git treats nul as reserved and effectively ignores it, so your remote is usually safe. It can still clutter the working tree and confuse git status.
The solution
Run PowerShell as Administrator and delete via the Windows UNC path:
cmd /c del /f /q "\\?\C:\YOUR-FOLDER\nul"Step by step
- Open PowerShell as Administrator (right-click Start → Terminal/PowerShell (Admin))
- Replace
YOUR-FOLDERwith the real path - Run the command
Example
# If your project is in C:\Users\you\projects\my-app
cmd /c del /f /q "\\?\C:\Users\you\projects\my-app\nul"Why this works
The \\?\ prefix tells Windows to bypass normal path parsing and access the file directly. That lets you target reserved names that normal APIs block.
Other reserved names
Same class of problem:
CON · PRN · AUX · NUL · COM0–COM9 · LPT0–LPT9