I cannot delete a file named con or nul.

John Savill

March 12, 2000

1 Min Read
ITPro Today logo in a gray background | ITPro Today

A. The syntax \. does not work with a file named con or nul .

In fact, no Win32 tool may delete these files.

A solution is to use non-Win32 tools.

For instance, the Resource Kit contains POSIX utilities such as rm.exe, whichallows to delete these files:

c:NTReskitposixrm con

Note: the files may have been created with a tool such as notepad or more,using the streams notation. For instance, type "notepad con:foo" on anNTFS partition, or "more < any_file > nul:bar"

There is an easier way, without using reskit and non-native subsystems whichis to rename the file then just delete:

C:> ren \.c:ul. file
C:> del file

About the Author

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like