I recently had Unix stations copy some files onto a Windows 2008 Server.  The problem was that some of those files used Windows restricted file names like “COM1” and “LPT1” so if you try to delete or rename it, you will receive an error like FILE DOES NOT EXIST.  After a huge amount of research I found:

“If the file name includes a reserved name (for example, “lpt1”) in the Win32 name space, you may not be able to delete the file. To resolve this issue, use a non-Win32 program to rename the file. You can use a POSIX tool or any other tool that uses the appropriate internal syntax to use the file.

Additionally, you may be able to use some built-in commands to bypass the typical Win32 reserved name checks if you use a particular syntax to specify the path to the file. For example, if you use the del command in Windows XP, you can delete a file named “lpt1” if you specify the full path to the file by using the following special syntax using the old DOS 8.3 file and folder short names:

del \\?\<x>:\<path_to_file>\<file-name>

example del \\?\c:\progra~1\microsoft\office\powerpo~1\lpt1

For additional information about deleting files with reserved names under Windows NT and Windows 2000, click the article number below to view the article in the Microsoft Knowledge Base:

120716 How to Remove Files with Reserved Names in Windows

For additional information about deleting files with reserved names under Windows XP, click the article number below to view the article in the Microsoft Knowledge Base:

315226 How to Remove Files with Reserved Names in Windows XP”


1 Comment

humble · February 26, 2014 at 8:54 am

just beautiful the way you explain it even in win 7 64bit old Dos plays a lovely role many thanks

Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *