Skip to content

Instantly share code, notes, and snippets.

@mlabrkic
Last active August 16, 2023 13:18
Show Gist options
  • Save mlabrkic/4a46c0b53553b3388a50fa77680dedd7 to your computer and use it in GitHub Desktop.
Save mlabrkic/4a46c0b53553b3388a50fa77680dedd7 to your computer and use it in GitHub Desktop.
"Multi Commander" script: run "Windows Terminal"
SCRIPT:
@var $app = "wt";
@var $fileDir = PathGetPathPart($selectedFile, 1);
// Run Windows Terminal: left "Command Prompt", and right my default "PowerShell"
// @var $args = "-d " + $fileDir + " cmd /k dir ; split-pane -d " + $fileDir;
// Run Windows Terminal: left my default "PowerShell", and right "bash" (via Windows Subsystem for Linux (WSL))
@var $args = "-d " + $fileDir + " ; split-pane -d " + $fileDir + " wsl.exe";
MC.Run CMD={$app} ARG={$args}
------------------------------------------------------------
https://learn.microsoft.com/en-us/powershell
"PowerShell" 7.3 installs to a new directory and runs side-by-side with "Windows PowerShell" 5.1.
------------------------------------------------------------
## "Windows Terminal"
https://learn.microsoft.com/en-us/windows/terminal/
https://learn.microsoft.com/en-us/windows/terminal/command-line-arguments
The wt command line accepts two types of values: options and commands.
wt [options] [command ; ]
------------------------------
### Windows Command Prompt:
Try it: Win-s(earch), Paste next line, Enter
wt -p "Command Prompt" ; split-pane -p "PowerShell"
or
Try it: Win-s(earch), cmd, Enter
Paste next line, Enter
wt -p "Command Prompt" ; split-pane -p "PowerShell"
echo %USERPROFILE%
wt -p "Command Prompt" -d %USERPROFILE%\Documents ; split-pane -p "PowerShell" -d %USERPROFILE%\Documents
wt ; new-tab cmd /k dir
wt -d %USERPROFILE%\Documents; new-tab -d %USERPROFILE%\Documents cmd /k dir
wt -d %USERPROFILE%\Documents; split-pane -d %USERPROFILE%\Documents cmd /k dir
NOTE:
wt -d %USERPROFILE%\Documents cmd /k dir ; split-pane -p "PowerShell" -d %USERPROFILE%\Documents
wt -d %USERPROFILE%\Documents ; split-pane -d %USERPROFILE%\Documents "wsl.exe"
------------------------------
### PowerShell
For example, to open Windows Terminal from PowerShell with three panes,
with the leftpane running a Command Prompt profile and the
right pane split between your PowerShell and
your default profile running WSL, enter:
Try it: Win-s(earch), type "powershell" (==> PowerShell 7), Enter
wt -p "Command Prompt" `; split-pane -p "Windows PowerShell" `; split-pane -H wsl.exe
NOTE:
wt -p "Command Prompt" -d $HOME\Documents `; split-pane -p "PowerShell" -d $HOME\Documents
------------------------------------------------------------
### Windows Terminal panes
https://learn.microsoft.com/en-us/windows/terminal/panes
------------------------------
https://learn.microsoft.com/en-us/windows/terminal/panes#zooming-a-pane
JSON
{
"command": "togglePaneZoom",
"keys": "ctrl+f11"
},
------------------------------------------------------------
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment