Fix "The directory name is invalid" On Windows 10/11

Directory Name Is Invalid Problem in Windows

This blog will explain the cause of the "Invalid directory name" error in Windows 10 and how to fix it. If you lose data due to this error, you can use data recovery software to recover data from Windows PC and external storage devices.

Fix "The directory name is invalid" On Windows 10/11

The "Invalid directory name" error message (see Figure 1) can appear at any time. Whether you're trying to open a program, connect any external storage device, or play a DVD drive on your system after installing Windows 10. It can happen due to many reasons such as corrupted system files, corrupted applications/software, and corrupted devices like USB, HDD, SD, or DVD. This error prevents you from accessing data stored on the system or drive. However, you can regain access to your data with the help of data recovery tools. Although in order to fix this error, you can try the following methods.

Figure 1: Invalid directory name error

How to fix the "The directory name is invalid" error?

This error can occur in different situations on different devices.

F:\directory name not valid on Windows 10

You can try to fix this error with the help of:

Method 1: Check for disk errors

Sometimes, the system hard drive can be the actual cause of this error. So, to check if it is the main reason and fix it, you can use Check Disk, a Windows utility that scans internal and external drives to repair them.

A sort of. Press Windows + E to open File Explorer and go to This PC. (See Figure 2)

Figure 2: Open File Explorer and go to This PC

b. Go to the local disk, right-click on it, and select properties (see Figure 3)

Figure 3: Right-click on the local disk and select properties

C. Now, go to the "Tools" tab and click "Inspect". (See Figure 4)

Figure 4: Go to Tools and click Inspect

d. Click Scan Drive (see Figure 5).

Figure 5: Select Scan Drive

e. Once done, restart your system and check if this method can help you resolve the issue.

Method 2: Run the CHKDSK command

You can also run the CHKDSK command to find any damage to any device and repair them to get rid of "The directory name is invalid" in Windows 10. To do this, follow these steps:

A sort of. Press Windows + X, find and open Command Prompt (Admin). (See Figure 6)

Figure 6: Open Command Prompt (Admin)

b. In the window that opens, type chkdsk /f /rd: and press Enter. (See Figure 7)

Figure 7: Running the CHKDSK command

If the device has any damage or other errors, this command may fix them and you may get rid of this error. However, you need to keep one thing in mind, the utility will find and mark bad sectors on the device and help Windows know not to read or store any data on those sectors.

However, this error can lead to the loss of all important data stored in these sectors of the device. To deal with this situation, you can recover data with the help of data recovery tools such as Stellar Data Recovery even after running the CHKDSK command on your device. This DIY software can recover lost data from Windows PC and all storage devices.

Method 3: Perform a clean boot

You can perform a clean boot to find out the specific software/application causing this error and uninstall it with the help of the following steps:

A sort of. Open System Configuration by typing MSConfig in the Windows search box.

b. Go to the Services tab, select Hide all Microsoft services, and click Disable All. (See Figure 8)

Figure 8: Hide all Microsoft services

C. Go to Startup and click Open Task Manager. (See Figure 9)

Figure 9: Open Task Manager

d. Select the item from the screen that could be causing this error and click Disable. (See Figure 10)

Figure 10: Disable broken startup items

e. When finished, exit the Task Manager and click OK on the Startup tab.

F. Reboot the system in a clean boot environment.

G. Follow the instructions given on the screen to try (respectively) uninstall the program/application in question.

H. After the process is complete, restart the system.

The C:\Windows\system32\cmd.exe directory name is invalid.

When you try to run a Command Prompt or Notepad program, you may encounter the following error message when another user on your system is logged in as an administrator using the "Run as" feature:

  • The C:\Windows\system32\cmd.exe directory name is invalid.
  • The C:\Windows\system32\Notepad.exe directory name is invalid.

Here you can see how to change command prompt properties by following these steps:

Method 1: Change Command Prompt Properties

To resolve this error message, change the Command Prompt properties or Notepad properties. You can follow the given steps:

A sort of. Type cmd in the Windows search box, right-click Command Prompt, and select Open file location. (See Figure 11)

Figure 11: Right-click on the ground and select Open file location

b. Right-click Command Prompt and select Properties. (See Figure 12)

Figure 12: Open Command Prompt Properties

C. Under the Shortcuts tab, for Start Inbox, change the value of %HOMEDRIVE%%HOMEPATH% to a system-wide value such as %WINDIR%. Finally, click OK. (See Figure 13)

Figure 13: Change the value in the command prompt properties

d. Reboot the system and see if the error is fixed.

e. Invalid directory name when playing DVD

Method 1: Run the Hardware and Devices troubleshooter

In this case, you can try to fix the problem by using the Hardware and Devices Troubleshooter, a Windows built-in utility for fixing device and hardware errors. Follow the given steps:

A sort of. Open Settings and go to Update & Security. (See Figure 14)

Figure 14: Go to Update and Security

b. Select and open the troubleshooter. (See Figure 15)

Figure 15: Go to the troubleshooter

C. Select Hardware and Devices. Now, click Run the troubleshooter. (See Figure 16)

Figure 16: Running the hardware and device troubleshooter

d. After the process is complete, restart your Windows PC. Check if the error is resolved.

Method two: Disable and enable the DVD/CD-ROM drive

You can try to fix this error by first disabling the DVD/CD-ROM drive and then enabling it with the help of the following steps:

A sort of. Press Windows + X, find Device Manager and open it.

b. Find the DVD/CD-ROM drive and expand it. Select the drive and right-click it, then click Disable Device. (See Figure 17)

Figure 17: Disable DVD/CD-ROM

C. Click Yes, go back to the device driver, right-click it and click Enable Device.

Invalid directory name when inserting USB/HDD/SD card

This error can occur with any external storage media device such as USB, HDD, SSD, SD card, etc. To fix this error, you can use several methods. You can run the device troubleshooter as described above. Other than that, you can run the CHKDSK command or update/uninstall the USB controller driver.

Method 1: Plug the device into a different USB port

Whenever you plug any SSD, USB, HDD or any storage device into the system and encounter this error, just try to plug the device into another port. This may resolve issues that indicate a problem with the port.

Method 2: Create a partition with unallocated space

If the error persists even after you plug the device into a different port, you might consider creating a simple partition with unallocated space. According to some users, this method helped them fix the bug.

A sort of. Go to Disk Management and find the device where unallocated space appears.

b. Right-click the device and click New Simple Volume (see Figure 18).

Figure 18: Select a new simple volume

C. Follow the on-screen instructions, and when you're done, disconnect and reconnect your device to check if it's working properly.

Method 3: Uninstall the USB controller driver

A corrupt or incompatible USB controller driver can be the reason behind the "Invalid directory name in Windows 10" error. You can try to fix it by uninstalling the USB controller driver. Follow the given steps:

A sort of. Go to Device Manager and open Universal Serial Bus Controllers (see Figure 19)

Figure 19: Selecting a Universal Bus Controller

b. Select the broken Universal Serial Bus controller, right-click it and click Uninstall. (See Figure 20)

Figure 20: Uninstalling corrupt/faulty USB controller driver

C. After completing the process, restart your PC and check if the problem is resolved.


The directory name invalid error message in Windows 10 can appear for many of the reasons we discuss in this article. You can resolve this error by running the CHKDSK command, performing a clean boot, changing Command Prompt/Notepad properties, uninstalling the USB controller driver, etc. However, while performing some of these methods, you may lose data. In this case, you can use Windows data recovery software such as Stellar Data Recovery. This do-it-yourself software can retrieve your data from Windows PC as well as external storage devices including USB, SSD, HDD, SD card, etc.

Next Post Previous Post
Comment Here
Add Your Comment
comment url

Donate Me