A simple Unix <-> Windows path converter
This is a simple Node tool that will convert back and forth between Windows and Unix-style paths.
The conversion is pretty simple, if the input path contains backslashes (\) then it assumes Windows -> Unix and if it contains slashes (/) it will convert Unix -> Windows.
Because it's a Node app it should pretty much work anywhere you have your Node environment set up (Windows CMD, Msys Git command prompt, etc.). It works well in a Windows Msys environment where you're likely to run into both path styles at some point.
This tool is designed to be run from the command-line.
npm install --global git://github.com/Coridyn/path-convert.git
This will set up the tool with the global pc
command.
The tool will read the path as an input argument or read it from stdin.
Option 1: Path as an input argument:
$ pc /C/Users/username
C:\Users\username
Option 2: Read from stdin:
$ pc
Enter path:
C:\Users\username
/C/Users/username
You can easily chain it together with other commands too.
On Windows:
cd | pc
In Bash (or similar shells):
$ pwd | pc
On Windows copy the converted path to the clipboard like this:
cd | pc | clip
In a Bash shell on Windows:
pwd | pc | clip
NOTE: On Unix-style shells you might need to escape or quote backslashes.
If you get output like this:
pc c:\Users\username
c:Usersusername
Quote the input path:
pc "c:\Users\username"
/c/Users/username
Or escape the backslashes:
pc c:\\Users\\username
/c/Users/username