Asked  8 Months ago    Answers:  5   Viewed   46 times

Solved by restoring Windows to previous state

The message (The system cannot find the path specified.) shows...

1) When i open new CMD (Win+R => cmd). It starts with introduction. (on line 3)

Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.
The system cannot find the path specified.


2) When i execute some command like cmd /C dir (or cmd /C php -v or whatever) (on line 2)

C:UsersViliamKopecky>cmd /C dir
The system cannot find the path specified.
 Volume in drive C is Windows7_OS
 Volume Serial Number is 8230-1246

C:WindowsSystem32>cmd /C php -v
The system cannot find the path specified.
PHP 5.4.8 (cli) (built: Oct 16 2012 22:30:23)
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2012 Zend Technologies

3) (the most annoying) when i run exec function from PHP or Node.js or probably any scripting lang. (which are probably runned from inside as cmd /C <command>)

The message does not show...

1) when i execute the command right from the cmd (or mingw, ...)

 Volume in drive C is Windows7_OS
 Volume Serial Number is 8230-1246

 Directory of C:UsersViliamKopecky

Let's start with simple command from cmd.

php -r "exec('dir', $stdout, $stderr); print(implode("n", $stdout), $stderr);"

and the result is like this (the directory test is empty - that is correct):

E:test>php -r "exec('dir', $stdout, $stderr); print(implode("n", $stdout), $stderr);"
The system cannot find the path specified.
 Volume in drive E is www
 Volume Serial Number is 0C99-95EC

 Directory of E:test

09.11.2012  22:42    <DIR>          .
09.11.2012  22:42    <DIR>          ..
               0 File(s)              0 bytes
               2 Dir(s)  13 495 296 000 bytes free

Which shows that the command dir has is executed from php correctly. Only thing thats wrong is the second line - The system cannot find the path specified. - that should not be there.

This message is output by exec from PHP (and also from Node.js as require('child_process').exec("dir", function(err, stdout, stderr) {console.log(stderr)});)

When I execute command right from cmd (or mingw, etc.) it executes correctly without the message. Environment variable PATH seem ok. Problem is just executing from script environment through exec functions.

How to get rid of that annoying message? Thanks



The problem is that some program has been set to autorun when you run cmd.exe. In my case it was ANSICON that was installed... and then I moved the file without properly uninstalling.

I found a solution in this blog post:

The short version is to find

HKCUSoftwareMicrosoftCommand ProcessorAutoRun

and clear the value.

Wednesday, March 31, 2021
answered 8 Months ago

You'll have to add the directory in which the php executable is located to your "path" variable (I guess in your case that would be E:logicielsUwAmpapachephp_5.2.11 ). In Windows, you can do that as described here:

Any directory you place in this path variable (they're separated by a semicolon) will be automatically used in, for example, a cmd shell.

Wednesday, March 31, 2021
answered 8 Months ago


The first time I had this error, the problem was that my php folder only had read permissions, when I changed the permissions to: read and write php worked correctly.


The second time I had this error, it was because of two programs (virus) called: explorer.exe and svchost.exe. In this case, the best solutions are: format the PC or try an antivirus (the Windows defender does not detect them).

I fix the problem manually, if you also want to do it I detail the steps here:


1) Check if your problem is the same: Open the "Task Manager" and look for these in the "Startup" and "Processes" tab.

  • explorer.exe (Different from windows explorer)
  • svchost.exe (It appears without name in the "processes" tab)

If this is not your case, the steps will not work, it is possible that another virus is causing the problem.

2) Make a backup, in case something goes wrong and you have to format your computer.


Step 1: Open the "Task Manager", click on the "startup" tab, look for the names: explorer.exe and svchost.exe, mark them as disabled and restart the computer.

Step 2: In a file explorer, open the window: "Folder options", click on the "view" tab, enable the option: "Show hidden files and folders" and below disable the option: "Hide protected operating system files", then click the Apply button and close the window.

Step 3: Find these files and delete them, if the system does not let you delete them you will have to change the owner of the files:

If you have doubts about these files you can search them on the internet. These files should not be in that folder.


Step 4: It is recommended to replace your PHP folder and reconfigure it (In my case when executing PHP the virus was re-generated and I had to follow all the steps again).

Step 5: Restart the computer, open the command prompt and try the "php -v" command. Don't forget to enable "Hide protected operating system files" option in "Folder options".

After these steps PHP worked correctly.

I hope this helps.

Wednesday, March 31, 2021
answered 8 Months ago

Open the Registry Editor (Windows key and type regedit in the prompt) Go to HKEY_CURRENT_USERSoftwareMicrosoftCommand ProcessorAutoRun and clear the values. If it exists in HKEY_LOCAL_MACHINESoftwareMicrosoftCommand ProcessorAutoRun, delete it as well.

Sunday, August 15, 2021
answered 3 Months ago

It seems that it is hardlinks which Cygwin uses a lot are not handled correctly by Docker. And in particular when Docker tries to commit an image it fails with "hcsshim::ImportLayer - cannot find the path" error.

I run in the same problem recently and after I got rid of the hardlinks in Cygwin installation I was able to commit the image without problems.

To get rid of the hardlinks I have zipped and unzipped Cygwin folder.

Friday, August 20, 2021
answered 2 Months ago
Only authorized users can answer the question. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :