簡體   English   中英

如何從 PowerShell 控制台中使用 Visual Studio Code 打開文件?

[英]How to open a file with Visual Studio Code from within a PowerShell console?

我嘗試從 PowerShell 控制台中打開 Visual Studio Code 中的文件。 換句話說,我想在右鍵單擊文件以使用非默認應用程序打開它時模擬Open with選項,但來自 PowerShell 命令行。 我用這個解決方案發現了一個 Stack Overflow 問題:

Visual studio code D:\testfolder\index.html

但它不起作用。 關於如何解決它有什么想法嗎?

如果您打開了現有的 vs 代碼 window 並且您想在新的單獨 window 中打開文件,您也可以使用 -n 標志。 所以命令將是

code D:\testfolder\index.html -n

或者

code -n D:\testfolder\index.html

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM