我正在输入cd ~ C:\Desktop\gitPractice
并收到此返回:
bash: cd: too many arguments
为了能够更改目录,我需要在这里修复什么?
答案1
正如在扩展中所说,Windows“CD”命令不知道波浪号是什么,并且只接受一个参数。
cmd /?
帮助说:
Changes the directory or displays its name.
CHDIR [/D] [drive:][path]
CHDIR [..]
CD [/D] [drive:][path]
CD [..]
.. Specifies that you want to change to the parent directory.
Enter "CD drive:" to display the current directory on the specified drive.
drive. CD without parameters displays the current drive and directory.
directory is displayed.
Use the /D option to change the current drive in addition to changing the directory.
also change the current drive.
If the command extensions are activated, CHDIR is changed as follows
changed:
The specified directory name is converted so that it matches the name in terms of upper and lower case.
case-sensitive to match the name on the drive. For example
CD C:\TEMP sets the current path to the directory C:\Temp if a directory with this name exists on the drive.
directory with this name exists on the drive.
The CHDIR command does not treat spaces as separators, so that it is
possible to change to a subdirectory whose name contains spaces
without enclosing the name in quotation marks. Example:
cd \WINNT\Profile\Username\Programs\Startmenu
is the same as:
cd "\WINNT\Profile\username\Programs\Startmenu"
If the command extensions are deactivated, the quotation marks must be
characters must be specified.
答案2
cd
需要一个参数。您提供两个 -~
和C:\Desktop\gitPractice
。
此外,Windows 版 git 中的 bash不使用驱动器号。因此命令将是cd /C/Desktop/gitPractice