在命令行中键入代码以启动 vscode 时如何避免此 wsh 错误? [英] When typing code in command line to launch vscode how to avoid this wsh error?

查看:23
本文介绍了在命令行中键入代码以启动 vscode 时如何避免此 wsh 错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含 code.js 文件的文件夹.

我想从该文件夹中的 cmd 启动 vscode,但是在键入code"时,出现 wsh 错误.如何强制启动 VSCode?

解决方案

您可以通过键入禁用 .js 关联

assoc .js=

这将允许 cmd 搜索 %PATH% 以查找可执行文件,并且它会根据需要点击 vscode.

我相信你明白为什么会这样.Windows 正在查看您键入的命令的当前文件夹,并找到可执行的内容 (code.js),然后停止查找其他内容.

I have a folder which contains a code.js file.

I want to launch vscode from cmd within that folder but when typing "code", I get wsh error. How to force to launch VSCode instead ?

解决方案

You can disable the .js association by typing

assoc .js=

That will allow cmd to search the %PATH% to find an executable and it will hit vscode as you wanted.

I am sure you realize why this is happening. Windows is looking at the current folder for the command you typed and finds something (code.js) that is executable, and stops looking for another.

这篇关于在命令行中键入代码以启动 vscode 时如何避免此 wsh 错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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