2013-05-02 41 views
11

我想通過使用git bash(msy​​sgit)將unix樣式路徑傳遞給Android adb命令,但shell正在錯誤地解釋我的路徑。這是我迄今爲止所嘗試的:如何通過git bash for windows將絕對路徑傳遞給adb命令?

$ 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 

什麼是正確的方法來做到這一點?

+0

您是否在「cmd」(dos-prompt)中嘗試了相同的操作?我認爲它會在那裏工作 – trans1st0r 2013-05-03 11:31:01

+0

@DevJyotiBehera是的,我確實用windows cmd提示符來嘗試它,它確實有效,但我試圖找出它爲什麼不能用於msysgit。我想了解路徑和引用在這裏工作的方式。 – 2013-05-03 21:14:44

+0

您是否檢查過http://stackoverflow.com/q/11519659/1983854?另外,'ls/mnt/sdcard /'是否工作?查看它是否正確檢測路徑。 – fedorqui 2013-06-17 11:16:50

回答

16

根據this answer,MSYS shell正在根據these rules修改文件名。按照重整規則,下面應該爲你工作:

adb push myfile '//mnt\sdcard\' 

(有兩個斜線和一個反斜槓所有剩餘斜線代替第一斜線)

+1

我能夠使用所有正斜槓(/) – Jayen 2013-11-08 23:37:48

6

adb push myfile //mnt/sdcard

Linux是不挑剔關於重複/ s

+0

是的,它的功能就像一個魅力。 – 2013-11-12 05:36:04

相關問題