Skip to content

Instantly share code, notes, and snippets.

@rootbsd
Created September 14, 2018 07:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save rootbsd/d7af9123684d35fcca566e9c4a8f3593 to your computer and use it in GitHub Desktop.
Save rootbsd/d7af9123684d35fcca566e9c4a8f3593 to your computer and use it in GitHub Desktop.
Open Explorer.exe in the current WSL -Windows Subsystem for Linux- directory (Ubuntu Only but easy to adapt)
function pop() {
if [ $(pwd | sed -n -e 's!^/mnt/!!p' | wc -c) == 0 ]
then
cmd.exe /c "echo %LOCALAPPDATA%" > /tmp/LOCALAPPDATA
dest="$(strings -a /tmp/LOCALAPPDATA)\\Packages"
cmd.exe /c "dir $dest | findstr CanonicalGroupLimited" > /tmp/Canonical
repo=$(strings -a /tmp/Canonical | awk '{print $NF}')
root=$(echo "$dest\\$repo\\LocalState\\rootfs")
explorer.exe $(echo ${root}$(pwd | sed 's!/!\\!g'))
else
explorer.exe $(pwd | sed -e 's!/mnt/!!g' -e 's!/!\\!g' -e 's/\(.\)\(.*\)/\1:\2/g')
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment