jpmc26
jpmc26

Reputation: 29876

Convert Windows formatted path to Unix style

Suppose you have a path like so:

$myPath = 'C:\Python\27'

Is there a more reliable in PowerShell way of converting that path to Unix format than just replacing the \s like this?

PS C:\> $myPath -replace '\\','/'
C:/Python/27

Upvotes: 7

Views: 3021

Answers (1)

Shay Levy
Shay Levy

Reputation: 126722

That's the way I would do it, I'm not familiar with any other (built-in) way.

Upvotes: 3

Related Questions