Summary
RECOMMENDED: Click here to fix Windows errors and optimize system performance
One of the reasons for the “Invalid file handle” error in Windows when deleting a file is that a reserved name is used for its name.
As mentioned in this Microsoft article, you should not use the following reserved names when creating files/folders in the Windows file system:
CON, PRN, AUX, NUL
COM1, COM2, COM3, COM4, COM5, COM6, COM7, COM8, COM9
LPT1, LPT2, LPT3, LPT4, LPT5, LPT6, LPT7, LPT8, LPT9
Also avoid these names, which are immediately followed by an extension; for example, NUL.txt is not recommended.
What is the cause of the’Invalid File Handle’ error message on Windows 10?
Well, the reason for this error is very clear after reading the naming conventions provided by Microsoft.
The file/folder name is a reserved name: The error message appears if the file to be deleted has a reserved name. The use of reserved names is prohibited by Microsoft and must not be denigrated.
Now that you know the Microsoft naming conventions and the cause of the error message, you can overcome them by following the solution below.
April 2021 Update:
We now recommend using this tool for your error. Additionally, this tool fixes common computer errors, protects you against file loss, malware, hardware failures and optimizes your PC for maximum performance. You can fix your PC problems quickly and prevent others from happening with this software:
- Step 1 : Download PC Repair & Optimizer Tool (Windows 10, 8, 7, XP, Vista – Microsoft Gold Certified).
- Step 2 : Click “Start Scan” to find Windows registry issues that could be causing PC problems.
- Step 3 : Click “Repair All” to fix all issues.
Deleting or renaming a folder with an invalid filename
- Open a command prompt window (click on the Start button and type “cmd”).
- Navigate to the folder containing this folder (type “cd temp\foldername\foldername\foldername\foldername\whatever”).
- Rename the file or folder with the long Win95/DOS file name; let’s pretend it’s called “invalidfilename” (ren invali~1 goodname).
- Delete the folder (rd goodname).
Apply hot fixes
Patches or service packs solve this problem as described below. The updates fix this problem.
Unless otherwise specified, Critical Hot Fix updates of the FTP server have only been tested with the English versions of our products.
Use the Command Prompt
You must use the command line. Start by typing cmd in the Start menu and pressing Enter.
Type this command in the command line window:
del “\\.\F:\Movies\Con Man\Con.Man.2018.720p.WEBRip.x264-[YTS.AM].mp4”
He should get rid of the file. Similar commands can be used for other problematic files.
(By the way, the.mp4 extension is in my opinion because you didn’t specify it. It may actually be different, adjust it accordingly.)
If the folder also resists deletion, empty it and use this command:
rd “\\.\F:\Movies\Con Man”
If you are trying to delete a file, proceed as follows:
Open a raised prompt as described above.
Type the following command, then press Enter :
del \\.\c:\Temp\con.txt
To delete a file, simply specify the file extension and use the del command instead of rd.
That’s all, you probably deleted the file/folder from your system.
RECOMMENDED: Click here to troubleshoot Windows errors and optimize system performance
CCNA, Web Developer, PC Troubleshooter
I am a computer enthusiast and a practicing IT Professional. I have years of experience behind me in computer programming, hardware troubleshooting and repair. I specialise in Web Development and Database Design. I also have a CCNA certification for Network Design and Troubleshooting.