是什么导致EXE扩展名在命令行上是必需的,以及如何在当前Shell中解决它?
我走的路很长。> 2048个字符,然后我安装了一个程序nodejs,该程序已添加到该路径。然后事情变得有些棘手。我遇到的问题是,当某些人的路径> 2048个字符时,似乎有些时候会遇到问题。我的大部分道路被删除了。(我的路径中仍然有一些旧的cmd shell,所以这不是一个大问题,因此我已将旧路径保存在文件中),windir环境变量在注册表中得到了(我认为没有设置)。而且我什至无法打开环境变量窗口(这是人们在路径> 2048 char时丢失windir变量时可能会遇到的症状)。因此,我使用setx进行创建,windir=c:\windows并打开了环境变量窗口,并将PATH固定为它的状态。现在我打开的cmd提示窗口就可以了。
但是在修复它之前,我仍然有一些较旧的cmd提示符窗口,并且我知道它们中的路径缩短了,并且我知道没有设置windir变量,但是我仍然看到它们中有一个奇怪的结果,我无法解释。而且我希望能够从这些cmd窗口中进行修复。
看来我需要将EXE放在可执行文件之后才能运行它。
C:\crp>path
PATH=C:\Ruby21\bin;C:\Program Files (x86)\IDM Computer Solutions\UltraEdit\;C:\Program Files (x86)\IDM Computer Solutions\UltraCompare\;C:\Program Files (x86)\Nmap;C:\Program Files (x86)\smartmontools\bin;C:\ProgramData\chocolatey\bin;C:\Users\user\AppData
\Roaming\npm
C:\crp>cd \windows\system32
C:\Windows\System32>ping
'ping' is not recognized as an internal or external command,
operable program or batch file.
C:\Windows\System32>ping.exe
Usage: ping [-t] [-a] [-n count] [-l size] [-f] [-i TTL] [-v TOS]
......
C:\Windows\System32>set path=
C:\Windows\System32>ping.exe
Usage: ping [-t] [-a] [-n count] [-l size] [-f] [-i TTL] [-v TOS]
.....
C:\Windows\System32>ping
'ping' is not recognized as an internal or external command,
operable program or batch file.
C:\Windows\System32>
和
C:\Windows\System32>ping
'ping' is not recognized as an internal or external command,
operable program or batch file.
C:\Windows\System32>set windir=c:\windows
C:\Windows\System32>echo %windir%
c:\windows
C:\Windows\System32>ping
'ping' is not recognized as an internal or external command,
operable program or batch file.
C:\Windows\System32>ping.exe
Usage: ping [-t] [-a] [-n count] [-l size] [-f] [-i TTL] [-v TOS]
有趣的是,我认为为将来的cmd提示解决的方法是永久设置windir,即使用setx(然后(转到环境变量窗口并修复了路径)。
我可以修复损坏的cmd会话中的路径,甚至可以修复该cmd会话中的windir,我知道这样做既无济于事,反而使EXE强制位于文件名末尾。所以我看不到原因..或如何解决特定的cmd会话。
新的cmd窗口很好。.但是,为了了解发生了什么,我希望能够从一个已结束的cmd会话中修复它。如果没有,那么我想知道为什么它无法在其中修复。
添加
与德米特里的帖子有关
C:\Windows\System32>echo %PATHEXT%
%PATHEXT%;.RB;.RBW
确实,我没有列出.EXE,并且在其中列出了文字%PATHEXT%有点奇怪。似乎几乎是无限递归的(如果DOS甚至要在那里处理递归/递归,那是不行的)!