How do I pass an absolute path to the adb command via git bash for windows?

元气小坏坏 提交于 2021-02-17 19:04:08

问题


I'm trying to pass a unix style path to the Android adb command using a git bash (msysgit) but the shell is interpreting my path incorrectly. This is what I've tried so far:

$ 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

What is the correct way to do this?


回答1:


According to this answer, the MSYS shell is mangling the file name according to these rules. According to the mangling rules, the following should work for you:

adb push myfile '//mnt\sdcard\'

(replace the first slash with two slashes and all remaining slashes with a backslash)




回答2:


adb push myfile //mnt/sdcard

linux isn't picky about duplicate /s



来源:https://stackoverflow.com/questions/16344985/how-do-i-pass-an-absolute-path-to-the-adb-command-via-git-bash-for-windows

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!