How to prevent MSYS to convert the file path for an external program

前端 未结 3 1753
难免孤独
难免孤独 2021-01-12 13:57

I\'m porting a Linux script to Windows & MinGW, which accesses the Android phone through ADB.

Sometime I need to pass the Android\'s file path as ADB command lin

3条回答
  •  难免孤独
    2021-01-12 14:39

    Just found starting the double-slash is the charm.

    http://www.mingw.org/wiki/Posix_path_conversion

    An argument starting with 2 or more / is considered an escaped Windows style switch and will be passed with the leading / removed and all \ changed to /.

    Except that if there is a / following the leading block of /, the argument is considered to be a UNC path and the leading / is not removed.

    | Argument from MSYS program | Sent to native Windows program as | Sent to native Windows program as
    | //foobar                   | /foobar                           | double /  prevents conversion
    | //foo\bar                  | /foo/bar                          | \  converted to /
    | //foo/bar                  | //foo/bar                         | interpreted as UNC path, leading /  not removed
    

提交回复
热议问题