Skip to content

Instantly share code, notes, and snippets.

@lski
Last active May 9, 2020 10:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lski/1fcdbe6ffabcce36b84deabc8c9f6bca to your computer and use it in GitHub Desktop.
Save lski/1fcdbe6ffabcce36b84deabc8c9f6bca to your computer and use it in GitHub Desktop.
A way of opening the WT terminal from a WSL terminal in the same directory
# Opens the current folder in the Windows Terminal
function term() {
# Open's terminal
function __runTerm() {
# Using the wslpath tool to convert the current directory to windows format
# which is required by wt. Also using printf to escape the characters so they arent expanded
local var=$(printf "%q" "$(wslpath -w $(pwd))")
# Run wt using powershell command
powershell.exe -command wt.exe -d "$var"
}
# Runs it in the background so that control returns to the current terminal
__runTerm &>/dev/null &
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment