[Bug] Windows: Creates undeletable nul files in working directory
Resolved 💬 3 comments Opened Dec 26, 2025 by xiaobai7891 Closed Dec 29, 2025
Bug Description
When using Claude Code on Windows, it repeatedly creates files named nul in the working directory and subdirectories. These files are extremely difficult to delete because NUL is a Windows reserved device name.
Environment
- OS: Windows Server 2019 (10.0.18362.295)
- Claude Code Version: Latest
- Shell: PowerShell / cmd
Steps to Reproduce
- Run Claude Code on Windows in any directory
- After some operations, check the directory
- A file named
nulappears in the working directory
Expected Behavior
No nul files should be created.
Actual Behavior
- Files named
nulare created in the working directory - These files cannot be deleted using normal methods (
del,Remove-Item, etc.) - Requires special Win32 API calls with
\\?\prefix to delete
Workaround
Use this Python script to delete the files:
import ctypes
from ctypes import wintypes
import os
kernel32 = ctypes.WinDLL('kernel32', use_last_error=True)
DeleteFileW = kernel32.DeleteFileW
DeleteFileW.argtypes = [wintypes.LPCWSTR]
DeleteFileW.restype = wintypes.BOOL
path = '\\\\?\\' + os.path.abspath('nul')
DeleteFileW(path)
Root Cause Hypothesis
Likely caused by output redirection using > nul or similar commands that behave differently in certain Windows shell environments, creating actual files instead of redirecting to the null device.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗