2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

VSCode のカレントディレクトリを Windows Terminal で開く

Posted at

VSCode 画面下部の統合ターミナル(PowerShell)で以下のコマンドを実行すると、統合ターミナルのカレントディレクトリで Windows Terminal が起動します:

wt -d .

なお、統合ターミナルのカレントディレクトリは通常ワークスペースのルートディレクトリですが、設定で terminal.integrated.cwd を変更している場合は異なります。

特定のプロファイルで開きたい場合は -p オプションでプロファイル名を指定します。以下の場合、Windows Terminal は Visual Studio 2019 の開発者コマンドプロンプトでカレントディレクトリを開きます:

wt -d . -p "Developer Command Prompt for VS 2019"

既に Windows Terminal を起動している場合、新規ウィンドウではなく新規タブで開いてほしい時もあるでしょう。-w オプションと nt サブコマンドを組み合わせることで実現できます:

wt -w 0 nt -d . -p "Developer Command Prompt for VS 2019"

その他のオプションやサブコマンドは Microsoft 公式のドキュメント(日本語版/英語版)を参照してください。たとえば、以下の画像のようにタブではなくペイン分割で表示させることもできます:

Windows Terminal command line argument for split panes 1

参考リンク

  1. https://github.com/MicrosoftDocs/terminal/blob/main/TerminalDocs/command-line-arguments.md

2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?