1

I need to run Windows Terminal with specific settings. I need it to start powershell in directory to C:\dir and type command yarn start to console input but not execute the command. I just want to have this command prepared and then I just press enter to execute the command when I am ready. This is my actual solution which automaticaly executes the command:

wt -p "Windows Powershell" -d C:\dir powershell -noExit yarn start

Edit: Is there any way to this feature work also with multiple panes?
Code provided by @mklement0 works only without panes and following code does not work.

wt `
-p "Windows Powershell" -d C:\dir1 `; split-pane `
-p "Windows Powershell" -d C:\dir2 `; split-pane `
-p "Windows Powershell" -d C:\dir3 powershell -noExit -c @'
  (New-Object -ComObject WScript.Shell).SendKeys('yarn start')
'@

Thank you

stemby
  • 11
  • 2

1 Answers1

1

In order to have your yarn start command appear at the PowerShell prompt without submitting it, you'll have to simulate user input:

wt -p "Windows Powershell" -d C:\dir powershell -noExit -c @'
  (New-Object -ComObject WScript.Shell).SendKeys('yarn start')
'@
mklement0
  • 382,024
  • 64
  • 607
  • 775