Start window's terminal from CLI and pass in an executable command to run Start window's terminal from CLI and pass in an executable command to run powershell powershell

Start window's terminal from CLI and pass in an executable command to run


wt new-tab -p "Command Prompt" -d "%cd%" cmd /k dir
  • You can omit new-tab (its a default command).
  • Omitting -d "%cd%" seems to be equivalent to -d "%USERPROFILE%".
  • You can omit -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.