Skip to content

Instantly share code, notes, and snippets.

@Wonno
Created July 31, 2025 13:57
Show Gist options
  • Select an option

  • Save Wonno/f3f03b94e980dd1dba9bd74ef2e179cf to your computer and use it in GitHub Desktop.

Select an option

Save Wonno/f3f03b94e980dd1dba9bd74ef2e179cf to your computer and use it in GitHub Desktop.
WSL Helpers
#!/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