将Windows格式化的路径转换为Unix样式 [英] Convert Windows formatted path to Unix style

查看:145
本文介绍了将Windows格式化的路径转换为Unix样式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设您具有这样的路径:

Suppose you have a path like so:

$myPath = 'C:\Python\27'

在PowerShell中,将路径转换为Unix格式是否比仅替换\更可靠?

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

推荐答案

这就是我要这样做的方式,我对任何其他(内置)方式都不熟悉.

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

这篇关于将Windows格式化的路径转换为Unix样式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆