Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save H0K5/6528ee0e0cc016cd76f1b1c8c81b7898 to your computer and use it in GitHub Desktop.

Select an option

Save H0K5/6528ee0e0cc016cd76f1b1c8c81b7898 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