Windows CMD.exe quot;The system cannot find the path specified.quot;(Windows CMD.exe“系统找不到指定的路径.)
问题描述
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“系统找不到指定的路径."的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Windows CMD.exe“系统找不到指定的路径."
基础教程推荐
- 有什么方法可以用编码 UTF-8 而不是 Unicode 返回 PHP`json_encode`? 2021-01-01
- 在PHP中根据W3C规范Unicode 2022-01-01
- Cron Jobs 调用带有变量的 PHP 脚本 2022-01-01
- 学说 dbal querybuilder 作为准备好的语句 2022-01-01
- 如何替换eregi() 2022-01-01
- PHP 类:全局变量作为类中的属性 2021-01-01
- 如何在 Laravel 5.3 注册中添加动态下拉列表列? 2021-01-01
- PHP PDO MySQL 查询 LIKE ->多个关键词 2021-01-01
- YouTube API v3 点赞视频,但计数器不增加 2022-01-01
- 如何在 Laravel 中使用 React Router? 2022-01-01
