Created
July 31, 2025 13:57
-
-
Save Wonno/f3f03b94e980dd1dba9bd74ef2e179cf to your computer and use it in GitHub Desktop.
WSL Helpers
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
| #!/bin/env bash | |
| # Change directory provided as Windows path. | |
| # Sample: | |
| # $ cdw "c:\windows\system32" | |
| # $ pwd | |
| # /mnt/c/windows/system32 | |
| function cdwin() { | |
| if [[ -z $1 ]] ; then | |
| echo "No path provided"; return | |
| fi | |
| cd "$(wslpath -a "$1")" || return | |
| } | |
| # Open Windows Explorer in provided WSL directory | |
| # Defaults to current directory if not provided | |
| # Sample: | |
| # $ winex /var/tmp | |
| function winex() { | |
| local DIR | |
| if [[ -z $1 ]] ; then | |
| DIR=$(pwd) | |
| else | |
| DIR="$1" | |
| fi | |
| explorer.exe "$(wslpath -a -w "${DIR}")" | |
| } | |
| # Quickly jump tp Workspace | |
| function ws(){ | |
| pushd "$HOME/Workspace" || return | |
| } | |
| function vboxmanage(){ | |
| /mnt/c/Windows/System32/cmd.exe /Q /C VboxManage.exe $@ | |
| } | |
| function packer(){ | |
| /mnt/c/Windows/System32/cmd.exe /Q /C packer.exe $@ | |
| } | |
| function vagrant(){ | |
| /mnt/c/Windows/System32/cmd.exe /Q /C vagrant.exe $@ | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment