Skip to main content

Command Palette

Search for a command to run...

Deleting `nul` files created in error by Claude code

Updated
2 min read
Deleting `nul` files created in error by Claude code

I’ve recently been given access to Claude Code at work, so I’ve been trying it out to see how I get on with it. I tend to run it from a Windows Command Prompt, and I’ve noticed that it keeps creating files named nul with 0KB size. Worse, when I try to delete them I have to provide admin credentials, and even as an admin the file isn’t actually deleted and reappears after refreshing Windows Explorer.

Claude Code sometimes runs commands which contain something along the lines of > ./nul, which I assume does something meaningful in Bash but not in Windows Command Prompt. Windows creates a file instead of whatever the intended behaviour is. Something about the filename nul means the normal Windows operations for deleting a file can’t be used. So how can I get rid of the file?

Happily, once I explained the problem to Claude, it gave me a Windows Command Prompt command to delete the file:

del "\\?\%CD%\nul"

This command needs running in the same directory as the nul file.

Apparently, the \\?\ prefix bypasses Windows' normal checks for reserved filenames, allowing you to directly access and delete the nul file. Admin permissions are not required. I’ve updated Claude’s instructions to try and avoid it creating more of these nul files in the future, but I suppose I’ll need to wait a while to see how that turns out!

More from this blog

T

Tim talks tech

76 posts