Using CMD to Create Undeletable Folder in Windows 10

May 16, 2018 updated by Admin Leave a reply »

How can I prevent a folder from being inadvertently deleted by myself? Worry about that your kids may accidentally delete your important documents? To avoid this situation, you can use a simple CMD trick to create undeletable and unrenamable folder in Windows 10.

How to Create Undeletable Folder in Windows 10 Using CMD?

The following keywords are reserved by Windows to name the internal devices, and you’re unable to create, delete or rename a folder that has its name from one of these words (case insensitive):

CON, PRN, AUX, CLOCK$, NUL, COM1, COM2, COM3, COM4, COM5, COM6, COM7, COM8, COM9, LPT1, LPT2, LPT3, LPT4, LPT5, LPT6, LPT7, LPT8, and LPT9

Fortunately, you can use the Command Prompt in Windows 10 to create folders with reserved names. Follow these steps:

  1. Open the Command Prompt as administrator.
  2. At the Command Prompt, enter the drive name like D: or E: where you wish to create the undeletable folder and press Enter.
  3. Next, type “md con\” command to create a folder with a reserved name “con” and press Enter.

    Now, open File Explorer and try to delete or rename the “con” folder, you’ll get the error message like “Could not find this item” or “invalid file handle“.

  4. As of the Fall Creators Update, Windows 10 can’t let you even browse the files inside the “con” folder.

    In order to move any important files into or outside of this undeletable folder, you may also have to do it by running the “move” command at the Command Prompt.

Deleting the Undeletable Folder:

Now you might be wondering – how to delete undeletable folder using CMD? Although, it is impossible to manually delete the folder using File Explorer, you can delete that folder by typing “rd /s /q con\” at the elevated Command Prompt.

This trick works also on Windows 8.1, Windows 8/7/Vista/XP. Try it yourself to create one such folder which can neither be deleted nor be renamed.