[英]How to open a file with Visual Studio Code from within a PowerShell console?
I try to open a file in Visual Studio Code from within a PowerShell console.我尝试从 PowerShell 控制台中打开 Visual Studio Code 中的文件。 In other words I want to emulate the option of Open with when right clicking a file to open it with the non-default application, but from the PowerShell command line.
换句话说,我想在右键单击文件以使用非默认应用程序打开它时模拟Open with选项,但来自 PowerShell 命令行。 I found a Stack Overflow question with this solution:
我用这个解决方案发现了一个 Stack Overflow 问题:
Visual studio code D:\testfolder\index.html
But it does not work.但它不起作用。 Are there any ideas on how to solve it?
关于如何解决它有什么想法吗?
you can also use -n flag if you have an existing vs code window open and you want to open the file in new seperate window.如果您打开了现有的 vs 代码 window 并且您想在新的单独 window 中打开文件,您也可以使用 -n 标志。 so the command will be
所以命令将是
code D:\testfolder\index.html -n
or或者
code -n D:\testfolder\index.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.