Can't delete or modify file/directory with reserved names

Published on
10,688 Points
Last Modified:
Some malware (including virus's and other types of programs with bad intentions) as well as some hardening programs and utility's sometimes create files and directorys with illegal names.

Why "illegal" ?
Because some names such as LPT1, LPT2, LPTx, PRN, CON and more are reserved as
they have a unique meaning to the operating system.

Trying to rename/delete/modify a file or directory with such an illegal file name will return
Access Denied

Open in new window

LPT1 (LPTx) for example is usually the parallel port on the computer,
CON is short for console, PRN is printer, etc...

So if you see a directory or file such as

Open in new window

And can't seem to be able and rename or delete it, the reason is that
some names such as PRN, LPTx (LPT1, LPT2, ...), CON and more are system reserved.

The solution is straight forward, to rename for example:
ren \\.\c:\LPT1 c:\NNN

Open in new window

The reason why the line above would work is because of it's prefix:

Open in new window

This is a back door of sorts that causes Windows not to check for illegal file names, this would also
prevent certain commands and is the easiest method to get rid of such files and directory's without disk hex editing.

If you still can access it the file/directory either has attributes turned on, turn off using:
attrib -s -h -r \\.\c:\LPT1

Open in new window

The file/directory might not provide have ACL rights to allow you access, to grant access:
cacls \\.\c:\LPT1 /t /c /g %username%:f

Open in new window

It is highly recommended to have an updated Windows environment (patch's and updates from Microsoft) and have an updated Antivirus program on your system at all times.

1 Comment

Administrative Comment

Thank you.  Let's see what one of our technical Page Editors says.  I'm asking for their participation.

Articles Administrator

Featured Post

On-Demand: Securing Your Wi-Fi for Summer Travel

Traveling this summer?Check out our on-demand webinar to learn about the importance of Wi-Fi security and 3 easy measures you can start taking immediately to protect your private data while using public Wi-Fi. Follow us today to learn more!

Join & Write a Comment

Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…

Keep in touch with Experts Exchange

Tech news and trends delivered to your inbox every month