問題描述
1) 當我打開新的 CMD (Win+R => cmd) 時.它從介紹開始.(在第 3 行)
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.
C:UsersViliamKopecky>
2) 當我執行一些命令時,例如 cmd/C dir
(或 cmd/C php -v
或其他)(第 2 行)
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)(最煩人的)當我從 PHP 或 Node.js 或任何腳本語言運行 exec
函數時.(可能是從內部運行的 cmd/C
)
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>
)
1) 當我直接從 cmd(或 mingw,...)執行命令時
1) when i execute the command right from the cmd (or mingw, ...)
C:UsersViliamKopecky>dir
Volume in drive C is Windows7_OS
Volume Serial Number is 8230-1246
Directory of C:UsersViliamKopecky
<小時>
讓我們從 cmd 中的簡單命令開始.
Let's start with simple command from cmd.
php -r "exec('dir', $stdout, $stderr); print(implode("
", $stdout), $stderr);"
php -r "exec('dir', $stdout, $stderr); print(implode("
", $stdout), $stderr);"
結果是這樣的(目錄測試是空的 - 這是正確的):
E: est>php -r "exec('dir', $stdout, $stderr); print(implode("
", $stdout), $stderr);"
The system cannot find the path specified.
Volume in drive E is www
Volume Serial Number is 0C99-95EC
Directory of E: est
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)
這表明命令 dir
已從 php 正確執行.唯一錯誤的是第二行 - 系統找不到指定的路徑. - 不應該在那里.
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.
此消息由 PHP 的 exec 輸出(也來自 Node.js 作為 require('child_process').exec("dir", function(err, stdout, stderr) {console.log(stderr)});
)
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)});
)
當我直接從 cmd(或 mingw 等)執行命令時,它會正確執行而沒有消息.環境變量 PATH 似乎沒問題.問題只是通過 exec
函數從腳本環境執行.
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.exe 時自動運行.就我而言,安裝的是 ANSICON...然后我在沒有正確卸載的情況下移動了文件.
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:
http://carol-nichols.com/2011/03/17/the-system-cannot-find-the-path-specified/
短版就是找
HKCUSoftwareMicrosoftCommand ProcessorAutoRun
HKCUSoftwareMicrosoftCommand ProcessorAutoRun
并清除該值.
這篇關于Windows CMD.exe“系統找不到指定的路徑."的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!