Windows CMD.exe“系统找不到指定的路径”。 [英] Windows CMD.exe "The system cannot find the path specified."

查看:4915
本文介绍了Windows CMD.exe“系统找不到指定的路径”。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

通过将Windows还原到上一状态解决



消息(系统找不到指定的路径。)显示...



1)当我打开新的CMD(Win + R => cmd)。它从介绍开始。 (第3行)

  Microsoft Windows [版本6.1.7601] 
版权所有(c)2009 Microsoft Corporation。版权所有。
系统找不到指定的路径。

C:\Users\ViliamKopecky>

2)当我执行如 cmd / C dir (或 cmd / C php -v 或其他)(第2行)

  C:\Users\ViliamKopecky> cmd / C dir 
系统找不到指定的路径。
驱动器C中的卷是Windows7_OS
卷序列号是8230-1246
...

C:\Windows \System32> cmd / C php - v
系统找不到指定的路径。
PHP 5.4.8(cli)(构建:2012年10月16日22:30:23)
版权所有(c)1997-2012 PHP组
Zend Engine v2.4.0,版权所有)1998-2012 Zend Technologies

3)(最讨厌的)当我运行 exec 函数从PHP或Node.js或可能任何脚本lang。 (它们可能是从 cmd / C< command> 内部运行的)



..

1)当我从cmd(或mingw,...)执行命令

  C:\Users\ViliamKopecky> dir 
驱动器C中的卷为Windows7_OS
卷序列号为8230-1246

目录的C:\Users\ViliamKopecky








php -rexec('dir',$ stdout,$ stderr); print(implode \\\\\
\,$ stdout),$ stderr);



,结果如下目录测试为空 - 这是正确的)

  E:\test> php -rexec ('dir',$ stdout,$ stderr); print(implode(\\\\
\,$ stdout),$ stderr);
系统找不到指定的路径。
驱动器E中的卷是www
卷序列号是0C99-95EC

E目录:\test

09.11.2012 22:42 < DIR> 。
09.11.2012 22:42< DIR> ..
0文件0字节
2 Dir(s)13 495 296 000字节free
int(1)

这说明命令 dir 正确地从php执行。只有错误的事情是第二行 - 系统找不到指定的路径。 - 不应该在那里。



通过exec从 PHP (也从 Node.js 作为 require('child_process'))exec(dir,function(err,stdout ,stderr){console.log(stderr)});



当我从cmd(或mingw等)它会正确执行而不包含消息。环境变量PATH似乎确定。问题只是从脚本环境通过 exec 函数执行。



如何摆脱烦人的消息?感谢

解决方案

问题是,当您运行cmd.exe时,某些程序已设置为autorun。
在我的例子中是ANSICON安装...然后我移动了该文件没有正确卸载。



我在这篇博文中找到了一个解决方案:



http://carol-nichols.com/2011/03/17/the-system-cannot-find-the-path-specified/



简短版本是找到



HKCU\软件\Microsoft\Command Processor\AutoRun



并清除该值。


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.

C:\Users\ViliamKopecky>

2) When i execute some command like cmd /C dir (or cmd /C php -v or whatever) (on line 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>)

The message does not show...

1) when i execute the command right from the cmd (or 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.

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.

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:

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.

这篇关于Windows CMD.exe“系统找不到指定的路径”。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆