Created
January 17, 2026 17:01
-
-
Save blockedby/1f7cb26c581d650520e34a59b8467548 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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