nuits.jp blog

C#, Xamarin, WPFを中心に書いています。Microsoft MVP for Development Technologies。

Windows TerminalをExplorerのアドレスバーからカレントディレクトリで開く

Explorerのアドレスバーに「wt」と入力するとWindows Terminalを起動できますが、起動時のカレントパスがアドレスバーのパスになってくれない問題の解決方法です。

ただどうも過渡期の問題で、2020年1月7日時点はこの対処方法で対応できますが、将来的にはスマートに解決されるかも?

Windows Terminal: Open terminal in current folder via single command · Issue #620 · microsoft/terminal · GitHub

設定方法

Windows TerminalのSettingsを開きます。

f:id:nuitsjp:20200107055736p:plain

jsonファイルが開かれるため、以下のように各プロファイルでstartingDirectoryを追加します。

{
  "$schema": "https://aka.ms/terminal-profiles-schema",

  "defaultProfile": "{574e775e-4f2a-5b96-ac1e-a2962a402336}",

  "profiles": [
    {
      "guid": "{574e775e-4f2a-5b96-ac1e-a2962a402336}",
      "hidden": false,
      "name": "PowerShell Core",
      "startingDirectory": ".",
      "source": "Windows.Terminal.PowershellCore"
    },

必要なすべてのプロファイルに追加しましょう。

以上です。