People who did Windows 10 upgrade or perform its clean install have reported being received the “directory name is invalid error” while plugging their USB flash drive, external hard drive or SD card into the PC. Also, they can’t access to certain files and directories.
The main reason for this issue seems to be corrupted, outdated or incompatible device drivers but it can be a result of damaged or faulty SATA port. You can see the instructions below to fix the issue. Create a restore point before that so that you can revert if any of anything goes wrong.
Fixes for the directory name is invalid error
Fix 1: Change the Start in Value
You receive the directory name is invalid error in CDM when you start CMD with different user using the RUN as feature. To get the fix, you need to change the Start in Value in the Command Prompt properties dialogue box, as stated below:
- Type CMD in the search box, right-click on the Command Prompt and select Open File location,
- Right-click on the Command Prompt and select Properties,
- In the Start in box, change the value from %HOMEDRIVE%%HOMEPATH% to %WINDIR% or other system-wide value.
Fix 2: Disable DVD drive
When you encounter the error in question while trying to play a DVD disc on your computer, you should disable the DVD drive and you will see the error is gone:
- Press Win+ X and select Device Manager,
- Expand DVD/CD-ROM drives, right-click on your drive and click on Disable,
- Click Yes to confirm,
- Find your DVD driver the then and enable it.
Fix 3: plug-in your device with different port
When you insert your SD card, flash drive, and external hard drive into your computer and try to clean the Windows 10 or upgrade the system from the previous version of the operating system to Windows 10, you may encounter the directory name is invalid error in SD card/ USB/ external hard drive. The reason behind is that you inset your device with a dead USB port. In that case, you should plug your device with a different USB port.
Fix 4: Create a new partition with unallocated space
The error simply occurs when you access a USB drive or other external storage devices. In that case, you should consider creating a new simple partition with unallocated space:
- Press Windows + R to open Run,
- Type in diskmgmt.msc and hit Ok to open Disk Management,
- Right-click on the unallocated space and select New Simple Volume,
- Follow the on-screen instructions on the pop-up New Simple Volume Wizard
- Finish the rest of the steps and then access your drive again.
Fix 5: Check the disk errors
You may receive the directory name is invalid error because of disk run into issues. If you are not sure there is a problem with the disk, you can check it with its properties:
- Open This PC, right-click on the hard disk and select Properties,
- On the Tools tab, hit Check option under the Error checking to check your disk if there some disk errors,
- Click on Scan and repair the drive option and then restart the computer.
Fix 6: Update disk drivers
- Open Run and type in devmgmt.msc and hit Ok to open Device Manager,
- Expand the Disk drivers and right-click on your driver and click on Update driver.
Fix 7: the directory name is invalid error in Task Scheduler
if the issue is with the task scheduler, you may add some quotes on the file path. You need to remove those quotes and save the changes. Besides that, if you have system restore point, you can restore your system to return to the previous stage where the PC works fine.
Conclusion
Irrespective of what storage device you are using, you can fix the directory name is invalid error. One more thing is that creating a data back is necessary to avoid data loss. With a file back up in hand, you can restore the files from backup at any time.