Skip to content

Instantly share code, notes, and snippets.

@aseering
Created June 15, 2016 03:19
Show Gist options
  • Star 23 You must be signed in to star a gist
  • Fork 7 You must be signed in to fork a gist
  • Save aseering/a06219e74c7f96ccea5ec65d5b2483b5 to your computer and use it in GitHub Desktop.
Save aseering/a06219e74c7f96ccea5ec65d5b2483b5 to your computer and use it in GitHub Desktop.
#!/bin/bash
echo "$@" | sed -e 's|\\|/|g' -e 's|^\([A-Za-z]\)\:/\(.*\)|/mnt/\L\1\E/\2|'
@GrimTheReaper
Copy link

$ ls "$(winpath.sh $'C:\Program Files\Windows NT')"   
Accessories  TableTextService

@JacobDB
Copy link

JacobDB commented Mar 30, 2017

This is great :) How would I go about reversing it, going from a Unix path to Windows?

@JacobDB
Copy link

JacobDB commented Mar 30, 2017

@Scrxtchy
Copy link

you guys are the bomb

@icorbrey
Copy link

Never mind, got it basically working :) https://gist.github.com/JacobDB/e71e22c3663175b2369211aeb54362fe

But where's the gist?! T_T

@mauri870
Copy link

Just look for wslpath

@MathiasBaumgartinger
Copy link

For anyone interested, i created a small python script which can open any path (file/directory) from the WSL: https://gist.github.com/MathiasBaumgartinger/1f607cbf75203bd47c9fb0713741cf15

@AdamDanischewski
Copy link

Just look for wslpath

It would be nice if it did what I need it to, but unfortunately it doesn't help bypassing MAXPATH trying to change \?\d:\rsnapshot\backups to a useable path to no avail.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment