Cách sửa lỗi the directory name is invalid năm 2024

When you are logged on as one user (such as Administrator), and you try to run a program as a different user, you may experience the following symptoms. If you try to run the Command Prompt program or the Notepad program) as a different user by using the Run as feature, you may receive one of the following error messages:

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

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

To use the Run as feature, you click The following user in the Run as dialog box, type a user name in the User name box, and then type a password in Password box.

Cause

In Microsoft Windows XP and in Windows Server 2003, you cannot use the Run as feature to access the logged-on user's mapped home drive. The command prompt program or Notepad logs an error that states that the %HOMEDRIVE%%HOMEPATH% path is not valid for the session. This scenario occurs if the Start in property is set to %HOMEDRIVE%%HOMEPATH% on the Shortcut tab of the Command Prompt Properties dialog box or of the Notepad Properties dialog box. You receive the error message that is described in the "Symptoms" section of this article.

This problem may also occur if you type the name of the currently logged-on user in the User name box. Windows XP and Windows Server 2003 treat the two instances of the same user name as two different local users.

Resolution

To resolve this problem, change the Start in value in the Command Prompt Properties dialog box or in the Notepad Properties dialog box. To do so, follow these steps:

  1. Click Start, point to All Programs, and then point to Accessories.
  2. Right-click Command Prompt or Notepad, and then click Properties.
  3. In the Start in box, change the value from %HOMEDRIVE%%HOMEPATH% to a system-wide value such as %WINDIR%.
  4. Click OK.

Bạn cần thêm trợ giúp?

Bạn muốn xem các tùy chọn khác?

Explore subscription benefits, browse training courses, learn how to secure your device, and more.

Communities help you ask and answer questions, give feedback, and hear from experts with rich knowledge.

You will receive “the directory name is invalid in CMD” when you start CMD with a different user using Run as feature. To fix it, you can choose to change the Start in value in the Command Prompt Properties dialog box.

Step 1. Type cmd in the search box, right-click Command Prompt, and then select Open file location.

Step 2. Right-click Command Prompt and select Properties from its context menu.

Step 3. In the Start in box, change the value from %HOMEDRIVE%%HOMEPATH% to a system-wide value such as %WINDIR%.

FIX 2: Disable DVD drive

When you try to play a DVD disc on your computer, you may encounter “the directory name is invalid in Windows 10 DVD drive”. To fix it, you can try to disable DVD drive.

Step 1. Press Win + X and select Device Manager from the list.

Step 2. Expand DVD/CD-ROM drives, right-click your drive and select Disable device.

Step 3. Click Yes to confirm that you want to disable the DVD drive.

Step 4. Find your DVD drive and enable it.

Besides, you still can try to repair or remove Windows Essentials. You can go to Start > Settings > Apps > Windows Essentials, then click the Repair or Uninstall button to start the process.

FIX 3: Plug your device with a different USB port

When you plug the SD card, flash drive, external hard drive into your computer and try to clean install Windows 10 or upgrade your computer from the previous version of operating system to Windows 10, you may encounter “the directory name is invalid in SD card/USB/external hard drive”.

For this error, the simplest reason is that your insert your device with a dead USB port. Thus, if you encounter the same error with external storage devices, you can try to plug your device with a different USB port first.

FIX 4: Create a new simple partition with unallocated space

This directory name error may occur when you try to access a USB drive or other external storage devices. In this case, you can consider creating a new simple partition with unallocated space. Some users report that this method works perfectly.

Step 1. Press Win + R to summon the Run window, type diskmgmt.msc in the box and press OK to open Disk Management.

Step 2. Right click the unallocated space and select New Simple Volume.

Step 3. Follow the instructions on the pop-up New Simple Volume Wizard and finish the rest of steps.

Step 4. Try to access your drive again.

FIX 5: Check disk errors with Properties

If the disk run into issues, you may receive ”the directory name is not valid” error with external storage devices. If you are not sure that there is a problem with this disk, you can check it with its properties.

Step 1. You can open This PC, right-click the hard disk in the event of problems and select Properties from the context menu.

Step 2. Click Tools tab and hit Check Option under the Error checking. It will check your disk if there are some disk errors.

Step 3. Click Scan and repair drive and then restart your computer.

FIX 6: Update disk drivers with Device Manager

Step 1. Type devmgmt.msc in the Run window and press OK to open Device Manager.

Step 2. Expand Disk drives, right-click on your device and select Update driver.

FIX 7: The directory name is invalid in Task Scheduler

If you have this issue with Task Scheduler, you may add quotes in the file path. You can try to remove quotes in the file path and save changes. And then, see if your problem is solved.

Besides, if you have a system restore point, you can restore from a system restore point. It will restore your computer to a previous working state

Chủ đề