I can’t delete a directory called con, prn.
CON is a reserved name, so to delete you must use the UNC,
C:>rd \.<drive letter>:<dir>
example: “> rd \.c:tempcon”
This can also apply to the prn directory. At boot time, PRN is internally configured to direct any communication with the PRN device to LPT1 (just some background :) ).
I cannot delete a file named con or nul.
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, which allows 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 an NTFS partition, or “more < any_file > nul:bar”
There is an easier way, without using reskit and non-native subsystems which is to rename the file then just delete:
C:> ren \.c:nul. file
C:> del file
