Skip to content

Instantly share code, notes, and snippets.

@blockedby
Created January 17, 2026 17:01
Show Gist options
  • Select an option

  • Save blockedby/1f7cb26c581d650520e34a59b8467548 to your computer and use it in GitHub Desktop.

Select an option

Save blockedby/1f7cb26c581d650520e34a59b8467548 to your computer and use it in GitHub Desktop.
# add to ~/.bashrc
# Open Windows Terminal in specified directory (or current if . or no arg)
winterm() {
local target_dir="${1:-.}"
if [ "$target_dir" = "." ]; then
target_dir="$PWD"
elif [ ! -d "$target_dir" ]; then
echo "Error: Directory '$target_dir' does not exist" >&2
return 1
else
# Convert to absolute path if relative
target_dir=$(cd "$target_dir" && pwd)
fi
wt.exe wsl.exe -d Ubuntu-24.04 --cd "$target_dir"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment