How to Delete the Un-deletable 'nul' File Created by Claude Console on Windows 11
Source: Dev.to
The Mystery of the Un‑deletable “nul” File
If you’ve been using the Claude Console or Claude CLI tools on Windows 11, you might have encountered a frustrating little bug: a file named nul appearing in your directories that simply refuses to be deleted. Deleting it via the UI does nothing, and running del nul in the command line returns an error.
In Windows, NUL is a reserved system name. It isn’t meant to be a regular file; it’s a virtual device that discards data (the “black hole” of the OS). When tools like the Claude Console try to redirect output to “null” but the syntax doesn’t align with Windows’ expectations, the system can accidentally create a physical file named nul. Because the OS treats “NUL” as a protected device name, the standard del command can’t target it.
To remove the file you need to bypass Windows’ naming checks using the Universal Naming Convention (UNC). This tells Windows to treat the path literally, ignoring reserved‑name handling.
Why the file appears
- Tools built for Unix‑like environments sometimes use
> /dev/null‑style redirection. - On Windows, the equivalent is
> NUL, but if the syntax is malformed, Windows may create an actual file namednul. - The OS then blocks normal deletion because “NUL” is a reserved device name.
Deleting the file
Using Command Prompt (CMD)
del "\\?\D:\path\to\your\folder\nul"
Replace D:\path\to\your\folder with the actual drive letter and folder where the file resides. The \\?\ prefix is the “magic key” that allows operations on paths containing reserved names such as NUL, CON, or PRN.
Using PowerShell
Remove-Item -LiteralPath "\\?\D:\path\to\your\folder\nul"
The -LiteralPath parameter ensures PowerShell treats the path exactly as written, and the \\?\ prefix bypasses the reserved‑name check.
Keep this trick handy if you’re developing on Windows 11, as CLI tools—especially those primarily built for Unix‑like environments—may occasionally drop these “reserved” files into your folders by mistake.