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)
1)当我打开新的CMD(Win + R => cmd)时。它从介绍开始。 (第3行)
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
The system cannot find the path specified.
C:\Users\ViliamKopecky>
2) When i execute some command like cmd /C dir
(or cmd /C php -v
or whatever) (on line 2)
2)当我执行一些命令,如cmd / C dir(或cmd / C php -v或其他)(在第2行)
C:\Users\ViliamKopecky>cmd /C dir
The system cannot find the path specified.
Volume in drive C is Windows7_OS
Volume Serial Number is 8230-1246
...
C:\Windows\System32>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>
)
3)(最烦人的)当我从PHP或Node.js运行exec函数或者可能是任何脚本lang时。 (可能是从cmd / C
The message does not show...
1) when i execute the command right from the cmd (or mingw, ...)
1)当我从cmd(或mingw,...)执行命令时
C:\Users\ViliamKopecky>dir
Volume in drive C is Windows7_OS
Volume Serial Number is 8230-1246
Directory of C:\Users\ViliamKopecky
Let's start with simple command from cmd.
让我们从cmd的简单命令开始。
php -r "exec('dir', $stdout, $stderr); print(implode(\"\n\", $stdout), $stderr);"
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
int(1)
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.
这表明命令dir已经从php正确执行。唯一错误的是第二行 - 系统找不到指定的路径。 - 那不应该在那里。
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)});
)
此消息由exec从PHP输出(也来自Node.js作为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.
当我从cmd(或mingw等)执行命令时,它正确执行而没有消息。环境变量PATH似乎没问题。问题只是通过exec函数从脚本环境执行。
How to get rid of that annoying message? Thanks
如何摆脱那令人讨厌的消息?谢谢
3 个解决方案
#1
29
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.
问题是当您运行cmd.exe时某些程序已设置为自动运行。在我的情况下,安装了ANSICON ...然后我移动了文件而没有正确卸载。
I found a solution in this blog post:
我在这篇博文中找到了一个解决方案:
http://carol-nichols.com/2011/03/17/the-system-cannot-find-the-path-specified/
The short version is to find
简短的版本是找到
HKCU\Software\Microsoft\Command Processor\AutoRun
and clear the value.
并清除价值。
#2
0
This actually looks like a startup error with PHP, not with your code. Does
这实际上看起来像PHP的启动错误,而不是您的代码。是否
php -r "echo 1;"
php -r“echo 1;”
also throw the same error? If so, your php.ini file or an include may be pathed incorrectly.
还抛出同样的错误?如果是这样,您的php.ini文件或包含可能会被错误地修改。
php -i
should give you more info.
应该给你更多的信息。
#3
0
I think you should try this out ! I had the same issue and solved it like this :
我想你应该尝试一下!我遇到了同样的问题并解决了这个问题:
ok type : cd\windows\system32 After that you will see this: System32/: Type what you want (ex:ipconfig): System32: ipconfig Then that should do it ! :)
ok类型:cd \ windows \ system32之后你会看到:System32 /:输入你想要的东西(例如:ipconfig):System32:ipconfig然后应该这样做! :)
#1
29
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.
问题是当您运行cmd.exe时某些程序已设置为自动运行。在我的情况下,安装了ANSICON ...然后我移动了文件而没有正确卸载。
I found a solution in this blog post:
我在这篇博文中找到了一个解决方案:
http://carol-nichols.com/2011/03/17/the-system-cannot-find-the-path-specified/
The short version is to find
简短的版本是找到
HKCU\Software\Microsoft\Command Processor\AutoRun
and clear the value.
并清除价值。
#2
0
This actually looks like a startup error with PHP, not with your code. Does
这实际上看起来像PHP的启动错误,而不是您的代码。是否
php -r "echo 1;"
php -r“echo 1;”
also throw the same error? If so, your php.ini file or an include may be pathed incorrectly.
还抛出同样的错误?如果是这样,您的php.ini文件或包含可能会被错误地修改。
php -i
should give you more info.
应该给你更多的信息。
#3
0
I think you should try this out ! I had the same issue and solved it like this :
我想你应该尝试一下!我遇到了同样的问题并解决了这个问题:
ok type : cd\windows\system32 After that you will see this: System32/: Type what you want (ex:ipconfig): System32: ipconfig Then that should do it ! :)
ok类型:cd \ windows \ system32之后你会看到:System32 /:输入你想要的东西(例如:ipconfig):System32:ipconfig然后应该这样做! :)