5 Ways: Fix “The Directory Name is Invalid” in Windows 10/11
If you encounter the “The directory name is invalid” error, don’t worry. Read this short post to get 5 effective solutions.
Some users have encountered this annoying problem after installing or upgrading to Windows 10 - The directory name is invalid. There are also some users who meet this issue when they run Command Prompt or Notepad, or when they plug a USB flash drive, SD card, external hard drive, etc. into the computer.
If you are suffering from the same problem, read this tutorial to get several solutions, and never skip one step.
What does “The directory name is invalid” mean?
Invalid directory name is a Windows system error that prevents users from opening certain directories, files, or folders. There are some possible reasons that would result in the “the directory name is not valid” issue.
- The Windows system is corrupted or the Windows system cannot recognize your connected device temporarily.
- You are running a program with a different account than the one you are logged into Windows.
- The USB port is damaged.
- The USB driver is outdated or buggy.
- The storage device you plugged in is faulty.
After knowing what may have caused this issue, how to fix “the directory name is invalid” on Windows? Some effective solutions are offered in the following.
5 practical methods to fix “The directory name is Invalid” error
To solve the directory name is invalid on Windows 10 and other Windows operating systems, you can follow the tutorial below.
Fix 1. Change Command Prompt properties
If you encounter “the directory name is invalid” in CMD or meet “the directory name is invalid” when opening files, modifying the Start in value of the Command Prompt properties will help you resolve the issue.
Step 1. Type Command Prompt in the Windows search box and click on Open file location.
Step 2. Right-click the Command Prompt option and select Properties.
Step 3. Change the value in the Start in box from “%HOMEDRIVE%%HOMEPATH%” to “%WINDIR%”, and click OK to confirm it. Then, check if the alert would pop up again.
Next, let's see how to solve flash drive/SD card the directory name is invalid on Windows.
Fix 2. Reconnect your device
When you meet a USB drive the directory name is invalid, if you are not sure whether there is a problem with your USB, please first try to plug in your USB again with another port.
This is because there are times when the connected device cannot be recognized due to the failure of a USB port. Trying another port may be able to resolve it.
Fix 3. Check disk errors with CHKDSK
If you experience the directory name is invalid problem when accessing a hard drive, it is possible that the disk has file system errors or some logical problems. You can use CHKDSK to check and fix disk errors. This is a free Windows built-in tool that checks the integrity of computer hard drives and repairs bad sectors to recover corrupted hard drive. Here is what to do.
Step 1. Press Windows + S to open Search on Windows and type command prompt. Right click on it, and choose Run as administrator.
Step 2. Input the command chkdsk #: /f /r (replace # with the drive letter of the disk that you want to check).
Step 3. Tap on Enter and wait for the scanning and repairing process to finish.
Fix 4. Create a new partition with unallocated space
If neither of the above two methods solves the "The directory name is invalid for external hard drive" problem. You can try creating a new partition with unallocated space for the plugged-in hard drive.
Step 1. Open Run Command Box by Pressing WIN + R and paste diskmgmt.msc in it to open Disk Management.
Step 2. Right click the unallocated space, pick New Simple Volume, and click Next > specify the volume size.
Step 3. Then, choose Assign the following drive letter and specify a drive letter to click Next.
Step 4. Choose Do not format this volume and follow the on-screen guide to modify unallocated partition to a raw partition.
Fix 5. Update disk drivers
If the invalid directory name error is caused by outdated USB drivers, you could easily fix it by updating the driver. You can also use it to fix hard drive keeping disappearing problem.
Step 1. Type Device Manager in the search box on the taskbar and open it.
Step 2. Expand the drop-down menu of Disk drives, right click on the invalid hard drive, and select Update Driver.
Step 3. Choose Search automatically for drivers. If there is an updated driver, it will be installed automatically.
Bonus tip: How to recover files in Windows 10/11
The above methods can be helpful to the "the directory name is invalid" problem. However, it is noteworthy that your data is at risk of being lost during the repair process. In the unfortunate event that your data is lost, MyRecover is a good data recovery helper.
It is user-friendly recovery software that enables you to recover missing data with a few clicks. It is capable of data recovery in various situations, including disk format, partition loss, Windows crashes, and so on. It has many useful recovery features:
- Supports recovery of videos, audio, images, documents, emails, archives, and numerous data types and formats.
- Support data recovery from multiple devices, including SD card, USB flash drive, external hard drive, computer, etc.
- Offer file search and file filter to help you find target items quickly and easily.
- Compatible with Windows 11/10/8/7 and all Windows Servers and support file systems such as NTFS, FAT32, exFAT, and ReFS.
Next, get this simple-to-use and powerful recovery tool, and recover lost files on Windows with ease.
Step 1. Run the data recovery software and choose the drive where you lost files and click Start Scan.
Step 2. Browse recoverable items. You can recover files during the scanning, and you can sort files by file type.
Step 3. Select and preview the files you wish to recover. Click Recover x files, and recover lost data to a secure storage location.
There are many directories created on everyone's computer. Invalid directory names not only prevent us from accessing the files we need but can also lead to data loss. According to the guide above, you should know how to fix "the directory name is invalid" problem. In case of data loss, you could use the best Windows data recovery software MyRecover to get back data effortlessly.