How to Fix ‘The Directory Name Is Invalid’ (Error 267) in Windows 11

Inserting a USB flash drive, opening an external hard drive, or launching executable installers in Windows 11 occasionally triggers an abrupt dialogue box: ‘The directory name is invalid’ (System Error 267). Double-clicking folder shortcuts fails, Command Prompt scripts abort, and File Explorer refuses to enumerate folder contents. In Windows NT operating system architecture, Error 267 indicates that a Win32 file system API (such as CreateDirectory or SetCurrentDirectory) received a path string where a directory was expected, but the path pointed to a file, an invalid drive letter, or an unmounted filesystem volume.

What Triggers Error 267 in Windows 11?

The invalid directory error originates from file path parsing breakdowns:

  • Drive Letter Conflict or Missing Mount Point: An external USB or SD card assigned a drive letter that conflicts with an existing network mapping or virtual optical drive.
  • Corrupted Temporary Directory Environment Variables: The system %TEMP% or %TMP% environment variable pointing to a non-existent or inaccessible folder path.
  • Outdated or Corrupted USB Host Controller Drivers: USB hub controllers dropping packet synchronization during filesystem mounting.
  • Damaged File System (Dirty Bit Set): Corrupted Master File Table (MFT) records on NTFS, exFAT, or FAT32 drives caused by abrupt removal without safe ejection.

Step 1: Assign a Fresh Drive Letter via Disk Management

Resolve drive letter collisions and restore clean volume mount points.

  1. Press Win + X and select Disk Management.
  2. Locate your external USB drive or partition in the lower pane.
  3. Right-click the partition and select Change Drive Letter and Paths.
  4. Click Change.
  5. Select Assign the following drive letter and choose a different letter higher up the alphabet (e.g. M:, P:, or X:).
  6. Click OK and confirm. Open File Explorer to verify access to the drive.

Step 2: Check and Repair File System via CHKDSK

Scan and repair filesystem metadata corruption preventing directory parsing.

  1. Press Win + S, type cmd, right-click Command Prompt, and select Run as administrator.
  2. Run CHKDSK on the affected drive letter (replace X: with your drive letter):
    chkdsk X: /f /r
  3. Allow the disk scan to complete verification passes and bad sector repairs.
  4. Once complete, attempt to open the directory again.

Step 3: Verify and Restore Default TEMP Environment Variables

If installer executables fail with Error 267, repair broken temporary paths.

  1. Press Win + R, type sysdm.cpl, and press Enter to open System Properties.
  2. Switch to the Advanced tab and click Environment Variables at the bottom.
  3. Under User variables for your user, check the values for TEMP and TMP.
  4. The default value should be:
    %USERPROFILE%\AppData\Local\Temp
  5. If either points to a missing drive or custom folder, click Edit and restore the default path. Click OK, reboot your PC, and re-run your application.

Step 4: Reinstall USB Host Controller Drivers

Flushing stale hardware communication stacks clears transient I/O controller errors.

  1. Press Win + X and open Device Manager.
  2. Expand the Universal Serial Bus controllers section.
  3. Right-click each USB Root Hub and select Uninstall device.
  4. Restart your computer; Windows will automatically reinstall clean USB root hub drivers during boot.

Get the best tech tips delivered straight to your inbox.

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