Delete Files with Invalid Characters on Windows
How to delete files or folders with invalid characters in their names on Windows using short file names.
When Windows refuses to delete a file or folder because of invalid characters in its name, there’s a solution using the system’s short names (8.3 format).
Step by step
1. Open the command prompt and list short names
dir /x
This displays files with their short names in an additional column — something like MYFILE~1.
2. Delete using the short name
For files:
del MYFILE~1
For folders:
rmdir MYFOLD~1
The short name bypasses the problematic characters, allowing deletion to proceed normally.