在 Windows 10 上,我truffle.js在当前文件夹中有一个名为的文件。我truffle在 cmd 窗口中写入,希望调用truffle驻留在我路径上其他地方的程序。
相反,truffle.js在我最喜欢的 IDE 中打开(.js文件与该 IDE 相关联)。我认为这种行为仅适用于可执行文件.bat、.com和.exe. 为什么它会发生在一个.js文件上?
注意:我后来发现truffle我的路径上根本没有安装,但我的问题仍然存在:为什么 Windows 完成了我没有在非可执行文件上指定的扩展?
即使在安装 truffle 并重新启动 cmd 之后,我也无法让真正的 truffle 在包含文件的文件夹中运行truffle.js。
使用 Windows 10 命令提示符,我必须.exe在几乎所有命令之后键入才能使其工作。例如,
>ping google.com
'ping' is not recognized as an internal or external command,
operable program or batch file.
>ping.exe google.com
Pinging google.com [216.58.217.46] with 32 bytes of data:
Reply from 216.58.217.46: bytes=32 time=11ms TTL=55
>where java
'where' is not recognized as an internal or external command,
operable program or batch file.
>where.exe java
INFO: Could not find files for the given pattern(s).
>where.exe java.exe
C:\ProgramData\Oracle\Java\javapath\java.exe
Run Code Online (Sandbox Code Playgroud)
我在运行 SDK 管理器的 Android Studio 中遇到问题,我怀疑这与此有关。此外,这很烦人,我想知道它是否会破坏其他脚本。我不知道这究竟是什么时候开始发生的,但想不出我已经改变的任何设置可以做到这一点。
什么会导致 EXE 扩展在命令行中是强制性的,如何在当前 shell 中解析它?
我有一条很长的路。> 2048 个字符,我安装了一个添加到该路径的程序 nodejs。然后事情变得有点棘手。我遇到了一个问题,当他们的路径 > 2048 个字符时,有些人似乎在某个时候遇到了问题。我的大部分路径都被删除了。(我的路径仍然有一些旧的 cmd shell,所以这不是一个大问题,所以我将旧路径保存在一个文件中)并且在注册表中获得了 Windir 环境变量(我认为设置为空)。而且我什至无法打开环境变量窗口(这是人们在路径大于 2048 个字符并且丢失了 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] …Run Code Online (Sandbox Code Playgroud)