When you are trying to delete a file or folder on your system, you might come across the error message ‘Invalid file handle’. This error message occurs when the name of the folder or the file that you are trying to delete is a reserved name. The Windows operating system doesn’t deal with certain names/nicks due to which the File Explorer prevents you from giving your folder or file a reserved name. However, in case you get the file from your smartphone or another operating system like Linux, you will be prompted the said error message upon trying to delete it.
Microsoft Naming Conventions
The Microsoft Naming Conventions provide that files or folders on your system should not be named CON, PRN, AUX, NUL, COM1, COM2, COM3, COM4, COM5, COM6, COM7, COM8, COM9, LPT1, LPT2, LPT3, LPT4, LPT5, LPT6, LPT7, LPT8, and LPT9. This is because these names are reserved names in the Windows operating system, meaning they are used for a specific purpose by the Windows operating system and should not be used anywhere else. You should also avoid following the above names immediately by an extension, for example, NUL.txt. In case you want some more details, you can refer to this article on Microsoft’s website.
What causes the ‘Invalid File Handle’ Error Message on Windows 10?
Well, the reason for the emergence of the said error is quite clear after giving the Naming Conventions provided by Microsoft a read.
Now that you are aware of the Microsoft Naming Conventions and the cause of the error message, you can overcome it by following the solution given down below.
- How to Fix “Download Failed: Network Error” on Chrome
- How to adjust the settings of a home router
- Netflix Keeps Freezing: How to Fix Netflix Buffering | 2023
- What is Bfsvc? It's a virus? How to remove it?
- O&O DeskInfo displays Hardware & System information on the desktop
Read more:
Deleting the File or Folder
The files that are given a reserved name can be rendered useless because you can’t use them neither are you able to delete them using the standard procedure. To delete the file or folder, you will need to rely on some command prompt commands.
If you are facing the error message while deleting a directory, you can do so by following the steps given down below:
- Press Windows Key + X and select Command Prompt (Admin) from the list to open an elevated command prompt.
- Once the elevated command prompt opens up, type in the following command:
rd \.c:documentscon /S /Q
Deleting a Folder with a Reserved Name - In the above command, replace the path accordingly, however, make sure you do not remove the ‘\.’ before the path. Another example would be:
rd \.E:con /S /Q
Note:
The parameter /S is used to tell the rd command to remove all the sub-directories found in the specified directory while the /Q parameter is used to tell the command to remove contents of the specified directory silently (you won’t be given any prompts). Moreover, \. is used to refer to the current system.
In case you are trying to delete a file, do the following:
- Fix Localhost Err_connection_refused in Windows 10 & 11
- 12 Amazing Web Apps for Distraction-Free Writing
- 12 Best Free Opensource Mail Server Software 2022
- Bluetooth Not Detecting Devices on Windows 10: 6 Easy Fixes
- Bluetooth Headphones Not Working on Windows 10: 14 Proven Solutions
Read more:
- Open an elevated command prompt as shown above.
- Type in the following command and then hit Enter:
del \.c:Tempcon.txt
Deleting a File with a Reserved Name - To delete a file, you will just have to specify the extension of the file and use the command del instead of rd.
That’s it, you have probably deleted the file/folder from your system.
Source: https://appuals.com/fix-invalid-file-handle-on-windows-10/