请解释一下以下之间的区别:
x:/somepath/
/x/somepath/
x:\somepath\
....
通用路径是否适用于所有操作系统?我知道 Windows 使用
x:/somepath/
答案1
请逐一查看以下内容,我还附上了图片。
首先,你会发现与以下命令相关的执行Git 重击然后命令。
C:/Users/SJV/Desktop :适用于 Git Bash(Windows)
SJV@DESKTOP-UNO8EI3 MINGW64 ~
$ clear
(base)
SJV@DESKTOP-UNO8EI3 MINGW64 ~
$ cd C:/Users/SJV/Desktop
(base)
SJV@DESKTOP-UNO8EI3 MINGW64 ~/Desktop
$
/c/Users/SJV/Desktop/ :在 Git Bash(windows)上工作方式相同
(base)
SJV@DESKTOP-UNO8EI3 MINGW64 ~
$ cd /c/Users/SJV/Desktop/
(base)
SJV@DESKTOP-UNO8EI3 MINGW64 ~/Desktop
$
c:\Users\SJV\Desktop :在 Git Bash(windows) 上也同样有效
(base)
SJV@DESKTOP-UNO8EI3 MINGW64 ~/Desktop
$ cd c:\\Users\\SJV\\Desktop
(base)
SJV@DESKTOP-UNO8EI3 MINGW64 ~/Desktop
$ cd ~
(base)
c:\Users\SJV\Desktop :在 Git Bash(windows) 上不起作用
SJV@DESKTOP-UNO8EI3 MINGW64 ~
$ cd c:\Users\SJV\Desktop
bash: cd: c:UsersSJVDesktop: No such file or directory
(base)
SJV@DESKTOP-UNO8EI3 MINGW64 ~
$
C:\Users\SJV\Desktop :在 CMD(Windows)上运行
C:\Users>cd SJV
C:\Users\SJV>cd C:\Users\SJV\Desktop
C:\Users\SJV\Desktop>
C:\Users\SJV\Desktop>cd /c/Users/SJV
The system cannot find the path specified.
C:\Users\SJV\Desktop>