如何通过git bash for windows传递adb命令的绝对路径?

时间:2013-05-02 18:17:15

标签: windows git bash adb msys

我正在尝试使用git bash(msy​​sgit)将unix样式路径传递给Android adb命令,但shell正在错误地解释我的路径。这是我到目前为止所尝试的:

$ adb push myfile /mnt/sdcard/
failed to copy 'myfile' to 'C:/Program Files (x86)/Git/mnt/sdcard/': No such file or directory

$ adb push myfile "/mnt/sdcard/"
failed to copy 'myfile' to 'C:/Program Files (x86)/Git/mnt/sdcard/': No such file or directory

$ adb push myfile '/mnt/sdcard/'
failed to copy 'myfile' to 'C:/Program Files (x86)/Git/mnt/sdcard/': No such file or directory

这样做的正确方法是什么?

2 个答案:

答案 0 :(得分:23)

根据this answer,MSYS shell根据these rules修改文件名。根据修改规则,以下内容对您有用:

adb push myfile '//mnt\sdcard\'

(用两个斜杠替换第一个斜杠,用反斜杠替换所有剩余的斜杠)

答案 1 :(得分:6)

adb push myfile //mnt/sdcard

linux对重复/ s

并不挑剔