我在Windows上使用git bash
时,试图导航到我的驱动器位置E:/Study/Codes
。在命令提示符中,为了更改驱动器,我使用E:
,但在git bash
中会返回错误。
bash: E:: command not found.
如何将当前目录位置从/c/users
更改为E:Study/Codes
?
cd /E/Study/Codes
cd /mnt/e/Study/Codes
来导航到那个文件夹。 - ponir/mnt/...
符号表示法,那么对我来说驱动器字母的大小写是个问题,@skomisa。 - Benvorth只需将您的驱动器视为一个文件夹,然后执行cd e:
TL;DR; 针对 Windows 用户:
(如果路径中没有空格,不需要引号)
Git Bash: cd "/C/Program Files (x86)/Android"
// macOS/Linux 语法
Cmd.exe: cd "C:\Program Files (x86)\Android"
// Windows 语法
在 Windows 上使用 git bash
时,需要注意:
Git Bash: cd "/C/Program Files (x86)/Android"
// macOS/Linux 语法
Cmd.exe: cd "C:\Program Files (x86)\Android"
// Windows 语法
git
部分,只是用了bash
。此外,我的/C:
目录由于某种原因是/mnt
。不知道为什么。关于上述问题,我已启用了适用于Windows 10+的Linux框。如果您没有启用bash,则可能会看到该命令崩溃。 - Forrestbash
适用于我!Windows 10 1803 windows-subsystem for linux (WSL)与Ubuntu 18.04 LTS。 - CarpeDiemKopi还有一种方法在上述所有方法都不起作用时,对我来说有效(实话说,我没有尝试过GUI方法)。 根据超级用户的建议,尝试以下方法:
e:
就这样,没有任何cd
可以在gbash和Windows cmd中工作。
现在,可移动设备所在的驱动器号是哪个?
在 git Bash
中定位例如 USB 磁盘的两种方法:
$ cat /proc/partitions major minor #blocks name win-mounts
8 0 500107608 sda 8 1 1048576 sda1 8 2 131072 sda2 8 3 496305152 sda3 C:\ 8 4 1048576 sda4 8 5 1572864 sda5 8 16 0 sdb 8 32 0 sdc 8 48 0 sdd 8 64 0 sde 8 80 3952639 sdf 8 81 3950592 sdf1 E:\
$ mount C:/Program Files/Git on / type ntfs (binary,noacl,auto) C:/Program Files/Git/usr/bin on /bin type ntfs (binary,noacl,auto) C:/Users/se2982/AppData/Local/Temp on /tmp type ntfs (binary,noacl,posix=0,usertemp) C: on /c type ntfs (binary,noacl,posix=0,user,noumount,auto) E: on /e type vfat (binary,noacl,posix=0,user,noumount,auto) G: on /g type ntfs (binary,noacl,posix=0,user,noumount,auto) H: on /h type ntfs (binary,noacl,posix=0,user,noumount,auto)
...所以,在这个例子中,可能的驱动器号是 /e
(或者如果你非要写成 E:\ 的话),当知道 C、G 和 H 是其他内容(在 Windows 中)时。
cd /e/
只需输入cd E:Study/Codes
,它就会起作用。
cd c:/inetpub/wwwroot/blah