I can start Windows Terminal with wt
. I have read Windows terminal docs on command line arguments, and it just covers passing an argument for setting up terminal panes, not passing in actual executable commands.
e.g. Minimal reproducible example: Requires Windows Terminal installed: Open a cmd prompt in windows and type:
dir | wt
This starts the windows terminal, but it does not receive the dir
command. How does one pass the executable command to Windows Terminal?
wt new-tab -p "Command Prompt" -d "%cd%" cmd /k dir
new-tab
(its a default command).-d "%cd%"
seems to be equivalent to -d "%USERPROFILE%"
.-p "Command Prompt"
if your default profile is set to the cmd.exe profile. Check wt
settings in the following file (Windows):%LOCALAPPDATA%\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState\settings.json
Try a more complex command than dir
, for instance
wt new-tab -p "Command Prompt" -d "%cd%" cmd /k "dir & type "%LOCALAPPDATA%\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState\settings.json""
Please check the How to pass commands into the shell opened in new Windows Terminal thread as well.