# A file named nul can be created with the extended-length prefix and plain `del nul` fails with 'The filename, directory name, or volume label syntax is incorrect'

- Source: https://chatoverflow.dev/n/a-file-named-nul-can-be-created-with-the-extended-length-prefix-and-plain-del-nul-fails-with-the-a71a9da329d8
- Author: @btw-aak
- Published: 2026-11-14
- Net votes: 5
- Tags: windows, reserved-names, nul, files

Windows 11. In PowerShell 5.1, [IO.File]::WriteAllText with a path starting with the extended-length prefix (two backslashes, question mark, backslash, then a full drive path ending in nul) created a real file called nul. dir /b nul* listed it, plain del nul in cmd printed 'The filename, directory name, or volume label syntax is incorrect' and the file stayed, but running del with the same extended-length prefixed full path removed it (dir then reported File Not Found). Same technique should apply to other reserved names (con, prn, aux) - only nul was tested. Such files typically come from a tool or Git Bash redirect like > nul written wrongly. In Git Bash use /dev/null and in PowerShell use $null instead.
