How to Fix ‘The Directory Name Is Invalid’ in Windows 11

The error notification “The directory name is invalid” (Win32 Error Code 267 / 0x8007010B) appears when attempting to open a folder, execute a file from an external USB flash drive or SD card, run Command Prompt tasks, or launch third-party applications. This error signals that the Windows operating system cannot map or resolve the directory string requested by the application. This discrepancy occurs when drive letters conflict, external file systems suffer FAT32 or NTFS directory table corruption, user account permissions are restricted, or temporary shortcut paths point to non-existent drive roots.

Change and Reassign the Drive Letter in Disk Management

External hard drives, flash sticks, and card readers frequently encounter drive letter conflicts when Windows reassigns a letter previously reserved by an unmounted virtual drive or mapped network share.

  1. Press Windows Key + X and select Disk Management.
  2. Locate your external storage drive in the lower volume panel.
  3. Right-click the drive partition and select Change Drive Letter and Paths….
  4. In the dialogue box, click Change.
  5. From the dropdown menu, select a clean drive letter towards the end of the alphabet (such as X, Y, or Z) that avoids conflicts with network devices.
  6. Click OK and confirm the warning prompt.
  7. Open File Explorer and browse to the new drive letter to verify that the folder structure opens cleanly.

Execute Check Disk (CHKDSK) to Repair Directory Indexing

Unsafe removal of external storage media (unplugging without using “Safely Remove Hardware”) corrupts the Master File Table (MFT) or File Allocation Table (FAT).

  1. Press Windows Key + S, type cmd, right-click Command Prompt, and select Run as administrator.
  2. Execute the check disk utility against the target drive letter (replace E: with your specific drive letter):
    chkdsk E: /f /r
  3. CHKDSK will examine file records, validate folder security descriptors, and reconstruct damaged directory indexes.
  4. Once the process completes, attempt to access the directory again.

Fix the Command Prompt ‘Start in’ Directory Shortcut

If you encounter “The directory name is invalid” specifically when opening Command Prompt or PowerShell, the shortcut points to an obsolete user profile directory.

  1. Search for Command Prompt in the Windows Start menu.
  2. Right-click the Command Prompt shortcut and select Open file location.
  3. In the File Explorer window, right-click the Command Prompt shortcut icon and select Properties.
  4. Switch to the Shortcut tab.
  5. Inspect the Start in field:
    • If it contains an invalid variable or quotes, replace the entire line with: %HOMEDRIVE%%HOMEPATH% or simply C:\Windows\System32.
  6. Click Apply and OK to commit the correction.

Reinstall USB Controllers in Device Manager

Corrupted USB hub enumeration drivers can pass garbled device strings to the Windows I/O subsystem, making directories unreadable.

  1. Press Windows Key + X and select Device Manager.
  2. Expand the Universal Serial Bus controllers category.
  3. Right-click each USB Root Hub entry and select Uninstall device.
  4. After uninstalling, click the Action menu at the top of Device Manager and select Scan for hardware changes.
  5. Windows will automatically reinstall fresh USB host controller drivers.

Verify Folder Ownership and Security Permissions

If an internal folder triggers this error, restricted NTFS Access Control Lists (ACLs) can block file system traversal.

  1. Right-click the problematic folder and choose Properties.
  2. Switch to the Security tab and click Advanced.
  3. Next to Owner, click Change. Type your Windows username, click Check Names, and click OK.
  4. Check the box for Replace owner on subcontainers and objects.
  5. Click Apply and OK to reclaim administrative directory traversal rights.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.