我正在使用最新的 Windows Terminal + Windows 11 + Powershell 7,突然遇到了一个非常奇怪的问题。在重新启动、关闭和一切之后,我从 Windows 终端得到了非常奇怪的行为:
- 它没有从 PATH 变量中获取任何东西。尽管
$env:path.Split(";")
列出了它们,但所有必需的文件夹都包括 system32 和 windows。所以写ipconfig
例如让我The term inconfig is not recognizable
- 即使浏览到 \Windows\System32 并
ipconfig
在终端中写入也能让我The term ipconfig is not recognizable
- 启动它的唯一方法是导航到
system32
目录并添加 .exe,因此ipconfig.exe
. 当它打开时,它会在一个新窗口中进行操作,因此毫无用处。netstat
所有其他命令、 、dotnet
等也是如此。
不知道会是什么问题,以前有人遇到过这样的事情吗?
- 内置命令喜欢
dir
或ls
按预期工作。 - 我尝试了另一个终端,例如 git bash,并且像
ipconfig
预期的那样工作。
下面是我的参考路径。除了测试之外,我还删除了所有C:\Windows\System32
内容,但仍然有相同的行为,作为示例的 ipconfig 没有启动,除非我添加它.exe
并在新窗口中启动。
C:\Ruby31-x64\bin;
C:\Ruby26-x64\bin;
C:\Program Files (x86)\nodejs;
C:\Program Files\Git\bin;
C:\Users\Yehia\scoop\shims;
C:\Users\Yehia\AppData\Local\Programs\Python\Python37\Scripts\;
C:\Users\Yehia\AppData\Local\Programs\Python\Python37\;
C:\Program Files (x86)\Android\sdk\tools;
C:\Program Files (x86)\Apache\ant-1.9.4\bin;
C:\Program Files (x86)\Android\sdk\platform-tools;
C:\Program Files\Oracle\VirtualBox;
C:\Python27;
C:\Python27\Scripts;
C:\Users\Yehia\AppData\Local\Microsoft\WindowsApps;
C:\Users\Yehia\AppData\Roaming\Composer\vendor\bin;
C:\xampp-8.1\php;
C:\Program Files\Microsoft VS Code\bin;
C:\Users\Yehia\AppData\Local\GitHubDesktop\bin;
C:\Gradle\gradle-4.8.1\bin;
C:\Users\Yehia\.dotnet\tools;
C:\Program Files\Oracle Instant Client;
C:\Users\Yehia.000\AppData\Local\GitHubDesktop\bin;
%USERPROFILE%\AppData\Local\Microsoft\WindowsApps;
C:\Windows\System32\OpenSSH;
C:\Program Files\Ngrok;
%USERPROFILE%\.dotnet\tools;
C:\Stripe;
C:\Users\Yehia\AppData\Roaming\npm;
%JAVA_HOME%\bin;
C:\WINDOWS\system32;
C:\WINDOWS;