LoginSignup
3
0

More than 3 years have passed since last update.

Windows Terminal Startup Command (起動時に任意のコマンドを実行する)

Posted at

Windows Terminal で PC の起動時に任意のスクリプトやコマンドを実行する方法をまとめました。

Required

  • Windows Terminal version v0.9.433.0 or later

方法

  1. windows key + R を押す
  2. shell:startup と入力し、OKを押す
  3. 開いたエクスプローラでコマンドプロンプトのショートカットを作成 。 自分の環境では下の場所でした。 C:\Users\xxxxx\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup
  4. 右クリックしてプロパティを開き、ターゲットに下のように入力する。
C:\Windows\System32\cmd.exe /K wt -d [path to startup directory] wsl [command] & exit

ここまでで任意のコマンドは実行できるはずです。しかし、処理が終了した瞬間windows terminalが閉じてしまう。そこで、
6. windows terminal を開き、設定のプロフィールの中に"closeOnExit": "never"を追記する。

 参考

github microsoft/terminal issues 4864

3
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
3
0