英文:
VSCode Remote-SSH problem caused by cmd.exe crashed. 'Could not establish connection to "ServerName": Got bad result from install script'
问题
我之前能够使用VSCode的Remote-SSH扩展从我的Windows 10 PC连接到Linux服务器而没有任何问题。然而,现在我面临一个奇怪的问题,我收到一个错误消息,说:
无法建立与"MyServerName"的连接:从安装脚本中获得了错误结果
我尝试重新安装VSCode并尝试删除文件C:\Users\<your_user_name>\.ssh\known_host
,但都没有解决我的问题。
此外,我注意到我无法正常打开cmd.exe。每当我尝试打开它时,它会弹出然后立即关闭,而PowerShell可以正常工作。
我怀疑这可能是导致我的问题的原因。如果我能解决cmd.exe崩溃的问题,那么Remote-SSH的问题也可能会得到解决。
在注意到cmd.exe崩溃的问题后,我发现"Windows Terminal"和"wt.exe"都不见了。尽管尝试从Microsoft Store重新安装Windows Terminal,但我仍然无法像以前那样打开cmd.exe。
参考已解决重新安装终端的方法:
- https://stackoverflow.com/questions/62894666/path-and-name-of-exe-file-of-windows-terminal-preview
- Windows 11找不到"wt.exe"?这是如何修复的
- 中文解决方案 - vscode remote get bad result from install script
有人可以帮助我解决这个问题吗?我已经陷在这里很长时间了。
英文:
I was able to connect to a Linux server from my Windows 10 PC using VSCode's Remote-SSH extension without any issues before. However, I am now facing a strange problem where I get an error message that says:
Could not establish connection to "MyServerName": Got bad result from install script
I have tried reinstalling VSCode and also tried to delete the file C:\Users\<your_user_name>\.ssh\known_host
, but none of them worked for me.
Furthermore, I noticed that I cannot open cmd.exe normally on my Windows PC. Whenever I try to open it, it just pops up and then closes immediately, while PowerShell works fine.
I suspect that this might be the cause of my issue. If I can solve the issue with cmd.exe crashing, then the Remote-SSH issue might also be resolved.
After noticing the issue with cmd.exe crashing, I discovered that both "Windows Terminal" and "wt.exe" were missing. Despite attempting to reinstall Windows Terminal from the Microsoft Store, I am still unable to open cmd.exe as I could before.
reference solved reinstall terminal's method:
- https://stackoverflow.com/questions/62894666/path-and-name-of-exe-file-of-windows-terminal-preview
- Windows 11 Can't Find "wt.exe"? Here's How to Fix It
- Chinese solution - vscode remote get bad result from install script
Could someone please help me with this issue? I have been stuck on this for a long time.
答案1
得分: 1
I finally solved the issue by both the answer of @ZhangGe6 from this post!! and Could not establish connection to "hostname". I would provide a clear and complete process explanation in the hopes that it may help anyone else who is facing the same problem as me.
In short, the issue was indeed caused by cmd.exe crashing. Therefore, we need to resolve this problem. You can follow the bullet list steps to solve it. If you don't know how to do it, I will explain it in more detail below the bullet list.
Solution:
- Change the registry values
Autorun
inHKEY_CURRENT_USER\Software\Microsoft\Command Processor
fromif exists
to a blank (as this link suggests). Detail step as following:
2. Registry Values Located in Registry Editor, to open it: Type 'regedit' in the Run command window, and then press Enter.'
3. Now you can change the registry values "Autorun" in "HKEY_CURRENT_USER\Software\Microsoft\Command Processor" from "if exists" to a blank.
After doing that, my cmd.exe works fine! However, the usual problem faced by VSCode Remote-SSH "Could not establish connection to hostname" appear again.
- You can simplify the solution by deleting the fingerprint saved within the
known_hosts
file. In Windows, this is placed atC:\Users\<your_user_name>\.ssh\known_host
reference post.
Finally, Remote SSH works again.
英文:
I finally solved the issue by both the answer of @ZhangGe6 from this post!! and Could not establish connection to "hostname".
I would provide a clear and complete process explanation in the hopes that it may help anyone else who is facing the same problem as me.
In short, the issue was indeed caused by cmd.exe crashing. Therefore, we need to resolve this problem. You can follow the bullet list steps to solve it. If you don't know how to do it, I will explain it in more detail below the bullet list.
Solution:
- Change the registry values
Autorun
inHKEY_CURRENT_USER\Software\Microsoft\Command Processor
fromif exists
to a blank (as this link suggests). Detail step as following:
1. To open Run command window, you can either:
(1-1) Use the shortcut keys: 'Windows + R', or
(1-2) Right Click "Start", and click "Run" to open.
2. Registry Values Located in Registry Editor, to open it:
Type 'regedit' in the Run command window, and then press Enter.'
3. Now you can change the registry values "Autorun" in "HKEY_CURRENT_USER\Software\Microsoft\Command Processor" from "if exists" to a blank.
After doing that, my cmd.exe works fine! However, the usual problem faced by VSCode Remote-SSH "Could not establish connection to hostname" appear again.
- You can simplify the solution by deleting the fingerprint saved within the
known_hosts
file. In Windows, this is placed atC:\Users\<your_user_name>\.ssh\known_host
reference post.
Finally, Remote SSH works again.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论