How do I access MTP devices on the command line in Windows?











up vote
60
down vote

favorite
16












Most MTP (Media Transfer Protocol) devices show up in Windows File Explorer under their device name or a GUID, but they don't have a drive letter assigned.



How can I access the files on such devices from the command line? Using either cmd.exe or PowerShell.










share|improve this question




















  • 2




    The fact that the Linux MTP compatible implementations such as gphoto2 have a way to script uploading suggests that this should be possible on Windows somehow, assuming that Windows Media Player doesn't somehow block any other software from accessing the USB MTP interface... I too would like to know if this is possible.
    – Mokubai
    Dec 20 '11 at 22:00








  • 2




    I gave up trying to find a solution for this with my Android MTP device and ended up installing a WebDAV server on my device. This could be mounted as a network drive, albeit slowly.
    – Mark Booth
    Oct 14 '12 at 13:25










  • WebDAV...ugh... That's painful. It would work decently enough though. It's...surprising...to me that Windows can't seem to manage what Linux does out of box effortlessly. Oh, well.
    – Svartalf
    May 9 '14 at 19:57












  • @MarkBooth I tried the WebDAV server but it seems most of the files I transfer are corrupt (over 90%)...
    – Michael
    Dec 24 '16 at 18:20












  • Other solution for Android going the other way round, tweaking the connected device: 1, 2, 3.
    – Frédéric
    Jul 5 '17 at 11:08















up vote
60
down vote

favorite
16












Most MTP (Media Transfer Protocol) devices show up in Windows File Explorer under their device name or a GUID, but they don't have a drive letter assigned.



How can I access the files on such devices from the command line? Using either cmd.exe or PowerShell.










share|improve this question




















  • 2




    The fact that the Linux MTP compatible implementations such as gphoto2 have a way to script uploading suggests that this should be possible on Windows somehow, assuming that Windows Media Player doesn't somehow block any other software from accessing the USB MTP interface... I too would like to know if this is possible.
    – Mokubai
    Dec 20 '11 at 22:00








  • 2




    I gave up trying to find a solution for this with my Android MTP device and ended up installing a WebDAV server on my device. This could be mounted as a network drive, albeit slowly.
    – Mark Booth
    Oct 14 '12 at 13:25










  • WebDAV...ugh... That's painful. It would work decently enough though. It's...surprising...to me that Windows can't seem to manage what Linux does out of box effortlessly. Oh, well.
    – Svartalf
    May 9 '14 at 19:57












  • @MarkBooth I tried the WebDAV server but it seems most of the files I transfer are corrupt (over 90%)...
    – Michael
    Dec 24 '16 at 18:20












  • Other solution for Android going the other way round, tweaking the connected device: 1, 2, 3.
    – Frédéric
    Jul 5 '17 at 11:08













up vote
60
down vote

favorite
16









up vote
60
down vote

favorite
16






16





Most MTP (Media Transfer Protocol) devices show up in Windows File Explorer under their device name or a GUID, but they don't have a drive letter assigned.



How can I access the files on such devices from the command line? Using either cmd.exe or PowerShell.










share|improve this question















Most MTP (Media Transfer Protocol) devices show up in Windows File Explorer under their device name or a GUID, but they don't have a drive letter assigned.



How can I access the files on such devices from the command line? Using either cmd.exe or PowerShell.







windows command-line mtp






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Apr 16 '17 at 1:16

























asked Dec 20 '11 at 19:52









Peter Hahndorf

8,53453658




8,53453658








  • 2




    The fact that the Linux MTP compatible implementations such as gphoto2 have a way to script uploading suggests that this should be possible on Windows somehow, assuming that Windows Media Player doesn't somehow block any other software from accessing the USB MTP interface... I too would like to know if this is possible.
    – Mokubai
    Dec 20 '11 at 22:00








  • 2




    I gave up trying to find a solution for this with my Android MTP device and ended up installing a WebDAV server on my device. This could be mounted as a network drive, albeit slowly.
    – Mark Booth
    Oct 14 '12 at 13:25










  • WebDAV...ugh... That's painful. It would work decently enough though. It's...surprising...to me that Windows can't seem to manage what Linux does out of box effortlessly. Oh, well.
    – Svartalf
    May 9 '14 at 19:57












  • @MarkBooth I tried the WebDAV server but it seems most of the files I transfer are corrupt (over 90%)...
    – Michael
    Dec 24 '16 at 18:20












  • Other solution for Android going the other way round, tweaking the connected device: 1, 2, 3.
    – Frédéric
    Jul 5 '17 at 11:08














  • 2




    The fact that the Linux MTP compatible implementations such as gphoto2 have a way to script uploading suggests that this should be possible on Windows somehow, assuming that Windows Media Player doesn't somehow block any other software from accessing the USB MTP interface... I too would like to know if this is possible.
    – Mokubai
    Dec 20 '11 at 22:00








  • 2




    I gave up trying to find a solution for this with my Android MTP device and ended up installing a WebDAV server on my device. This could be mounted as a network drive, albeit slowly.
    – Mark Booth
    Oct 14 '12 at 13:25










  • WebDAV...ugh... That's painful. It would work decently enough though. It's...surprising...to me that Windows can't seem to manage what Linux does out of box effortlessly. Oh, well.
    – Svartalf
    May 9 '14 at 19:57












  • @MarkBooth I tried the WebDAV server but it seems most of the files I transfer are corrupt (over 90%)...
    – Michael
    Dec 24 '16 at 18:20












  • Other solution for Android going the other way round, tweaking the connected device: 1, 2, 3.
    – Frédéric
    Jul 5 '17 at 11:08








2




2




The fact that the Linux MTP compatible implementations such as gphoto2 have a way to script uploading suggests that this should be possible on Windows somehow, assuming that Windows Media Player doesn't somehow block any other software from accessing the USB MTP interface... I too would like to know if this is possible.
– Mokubai
Dec 20 '11 at 22:00






The fact that the Linux MTP compatible implementations such as gphoto2 have a way to script uploading suggests that this should be possible on Windows somehow, assuming that Windows Media Player doesn't somehow block any other software from accessing the USB MTP interface... I too would like to know if this is possible.
– Mokubai
Dec 20 '11 at 22:00






2




2




I gave up trying to find a solution for this with my Android MTP device and ended up installing a WebDAV server on my device. This could be mounted as a network drive, albeit slowly.
– Mark Booth
Oct 14 '12 at 13:25




I gave up trying to find a solution for this with my Android MTP device and ended up installing a WebDAV server on my device. This could be mounted as a network drive, albeit slowly.
– Mark Booth
Oct 14 '12 at 13:25












WebDAV...ugh... That's painful. It would work decently enough though. It's...surprising...to me that Windows can't seem to manage what Linux does out of box effortlessly. Oh, well.
– Svartalf
May 9 '14 at 19:57






WebDAV...ugh... That's painful. It would work decently enough though. It's...surprising...to me that Windows can't seem to manage what Linux does out of box effortlessly. Oh, well.
– Svartalf
May 9 '14 at 19:57














@MarkBooth I tried the WebDAV server but it seems most of the files I transfer are corrupt (over 90%)...
– Michael
Dec 24 '16 at 18:20






@MarkBooth I tried the WebDAV server but it seems most of the files I transfer are corrupt (over 90%)...
– Michael
Dec 24 '16 at 18:20














Other solution for Android going the other way round, tweaking the connected device: 1, 2, 3.
– Frédéric
Jul 5 '17 at 11:08




Other solution for Android going the other way round, tweaking the connected device: 1, 2, 3.
– Frédéric
Jul 5 '17 at 11:08










3 Answers
3






active

oldest

votes

















up vote
24
down vote



accepted










Unfortunately, APIs exposed by MTP are very different from a normal filesystem APIs. Therefore exposing MTP device as a read/write filesystem is not possible. The main reason:



Wikipedia says:




Neither the MTP nor the PTP standards allow for direct modification of objects. Instead, modified objects must be reuploaded in their entirety, which can take a long time for large objects. With PTP/MTP, the file size must be known at the opening stage.




Your common file copy program just opens a source and a target file, and copies data in chunks from the source file to the target. This won't work with MTP, since you need to use MTP special functions, and generic filesystem primitives (read, seek, write) are not available.



There are also other limitations. For example, the number of files that can be read or written simultaneously on an MTP device is severely limited. The device simply does not behave like a filesystem.



I suppose read-only filesystem driver for an MTP device might be possible, but because of the problems outlined above, it will be of very little use, so nobody bothered to create it.






share|improve this answer



















  • 3




    The read-only filesystem driver seems to exist now: ptpdrive.com
    – Arne de Bruijn
    Sep 12 '13 at 12:25






  • 4




    Actually, it's not "not possible". When you consider that I've got gphotofs and mtpfs as FUSE filesystems on Linux that're COMPLETELY Read/Write- its' quite possible to accomplish this as a "drive letter" under Windows...they've just not made it available or easy.
    – Svartalf
    May 9 '14 at 19:57


















up vote
1
down vote













You may be able to cobble something together with the MTP porting kit's MTPMon.



Alternatively, PowerShell can create COM objects and call their methods, so you may be able to use the APIs that Windows Explorer is using (for example, GetDeviceInfo() and GetObjectInfo()).






share|improve this answer






























    up vote
    1
    down vote













    There is a proprietary (but still nice) program: MTP Drive (http://www.mtpdrive.com/index.html ) which allows you to "mount" MTP devices as drives in Windows. With some reasonable limitations it does the great job!






    share|improve this answer





















    • 1. Can that synthetic MTP drive be feed to a common drive data recovery tools like EASEUS/Recuva/R-Studio and data be recovered effeciently? 2. Can I use robocopy/other fast data transfer tools to transfer data from that drive to windows native drives(C/D etc.) efficiently?
      – SIslam
      Aug 27 at 13:44













    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "3"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f369959%2fhow-do-i-access-mtp-devices-on-the-command-line-in-windows%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    3 Answers
    3






    active

    oldest

    votes








    3 Answers
    3






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    24
    down vote



    accepted










    Unfortunately, APIs exposed by MTP are very different from a normal filesystem APIs. Therefore exposing MTP device as a read/write filesystem is not possible. The main reason:



    Wikipedia says:




    Neither the MTP nor the PTP standards allow for direct modification of objects. Instead, modified objects must be reuploaded in their entirety, which can take a long time for large objects. With PTP/MTP, the file size must be known at the opening stage.




    Your common file copy program just opens a source and a target file, and copies data in chunks from the source file to the target. This won't work with MTP, since you need to use MTP special functions, and generic filesystem primitives (read, seek, write) are not available.



    There are also other limitations. For example, the number of files that can be read or written simultaneously on an MTP device is severely limited. The device simply does not behave like a filesystem.



    I suppose read-only filesystem driver for an MTP device might be possible, but because of the problems outlined above, it will be of very little use, so nobody bothered to create it.






    share|improve this answer



















    • 3




      The read-only filesystem driver seems to exist now: ptpdrive.com
      – Arne de Bruijn
      Sep 12 '13 at 12:25






    • 4




      Actually, it's not "not possible". When you consider that I've got gphotofs and mtpfs as FUSE filesystems on Linux that're COMPLETELY Read/Write- its' quite possible to accomplish this as a "drive letter" under Windows...they've just not made it available or easy.
      – Svartalf
      May 9 '14 at 19:57















    up vote
    24
    down vote



    accepted










    Unfortunately, APIs exposed by MTP are very different from a normal filesystem APIs. Therefore exposing MTP device as a read/write filesystem is not possible. The main reason:



    Wikipedia says:




    Neither the MTP nor the PTP standards allow for direct modification of objects. Instead, modified objects must be reuploaded in their entirety, which can take a long time for large objects. With PTP/MTP, the file size must be known at the opening stage.




    Your common file copy program just opens a source and a target file, and copies data in chunks from the source file to the target. This won't work with MTP, since you need to use MTP special functions, and generic filesystem primitives (read, seek, write) are not available.



    There are also other limitations. For example, the number of files that can be read or written simultaneously on an MTP device is severely limited. The device simply does not behave like a filesystem.



    I suppose read-only filesystem driver for an MTP device might be possible, but because of the problems outlined above, it will be of very little use, so nobody bothered to create it.






    share|improve this answer



















    • 3




      The read-only filesystem driver seems to exist now: ptpdrive.com
      – Arne de Bruijn
      Sep 12 '13 at 12:25






    • 4




      Actually, it's not "not possible". When you consider that I've got gphotofs and mtpfs as FUSE filesystems on Linux that're COMPLETELY Read/Write- its' quite possible to accomplish this as a "drive letter" under Windows...they've just not made it available or easy.
      – Svartalf
      May 9 '14 at 19:57













    up vote
    24
    down vote



    accepted







    up vote
    24
    down vote



    accepted






    Unfortunately, APIs exposed by MTP are very different from a normal filesystem APIs. Therefore exposing MTP device as a read/write filesystem is not possible. The main reason:



    Wikipedia says:




    Neither the MTP nor the PTP standards allow for direct modification of objects. Instead, modified objects must be reuploaded in their entirety, which can take a long time for large objects. With PTP/MTP, the file size must be known at the opening stage.




    Your common file copy program just opens a source and a target file, and copies data in chunks from the source file to the target. This won't work with MTP, since you need to use MTP special functions, and generic filesystem primitives (read, seek, write) are not available.



    There are also other limitations. For example, the number of files that can be read or written simultaneously on an MTP device is severely limited. The device simply does not behave like a filesystem.



    I suppose read-only filesystem driver for an MTP device might be possible, but because of the problems outlined above, it will be of very little use, so nobody bothered to create it.






    share|improve this answer














    Unfortunately, APIs exposed by MTP are very different from a normal filesystem APIs. Therefore exposing MTP device as a read/write filesystem is not possible. The main reason:



    Wikipedia says:




    Neither the MTP nor the PTP standards allow for direct modification of objects. Instead, modified objects must be reuploaded in their entirety, which can take a long time for large objects. With PTP/MTP, the file size must be known at the opening stage.




    Your common file copy program just opens a source and a target file, and copies data in chunks from the source file to the target. This won't work with MTP, since you need to use MTP special functions, and generic filesystem primitives (read, seek, write) are not available.



    There are also other limitations. For example, the number of files that can be read or written simultaneously on an MTP device is severely limited. The device simply does not behave like a filesystem.



    I suppose read-only filesystem driver for an MTP device might be possible, but because of the problems outlined above, it will be of very little use, so nobody bothered to create it.







    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited May 12 '12 at 6:33









    Peter Mortensen

    8,326166184




    8,326166184










    answered Jan 10 '12 at 20:08









    haimg

    16.7k1568110




    16.7k1568110








    • 3




      The read-only filesystem driver seems to exist now: ptpdrive.com
      – Arne de Bruijn
      Sep 12 '13 at 12:25






    • 4




      Actually, it's not "not possible". When you consider that I've got gphotofs and mtpfs as FUSE filesystems on Linux that're COMPLETELY Read/Write- its' quite possible to accomplish this as a "drive letter" under Windows...they've just not made it available or easy.
      – Svartalf
      May 9 '14 at 19:57














    • 3




      The read-only filesystem driver seems to exist now: ptpdrive.com
      – Arne de Bruijn
      Sep 12 '13 at 12:25






    • 4




      Actually, it's not "not possible". When you consider that I've got gphotofs and mtpfs as FUSE filesystems on Linux that're COMPLETELY Read/Write- its' quite possible to accomplish this as a "drive letter" under Windows...they've just not made it available or easy.
      – Svartalf
      May 9 '14 at 19:57








    3




    3




    The read-only filesystem driver seems to exist now: ptpdrive.com
    – Arne de Bruijn
    Sep 12 '13 at 12:25




    The read-only filesystem driver seems to exist now: ptpdrive.com
    – Arne de Bruijn
    Sep 12 '13 at 12:25




    4




    4




    Actually, it's not "not possible". When you consider that I've got gphotofs and mtpfs as FUSE filesystems on Linux that're COMPLETELY Read/Write- its' quite possible to accomplish this as a "drive letter" under Windows...they've just not made it available or easy.
    – Svartalf
    May 9 '14 at 19:57




    Actually, it's not "not possible". When you consider that I've got gphotofs and mtpfs as FUSE filesystems on Linux that're COMPLETELY Read/Write- its' quite possible to accomplish this as a "drive letter" under Windows...they've just not made it available or easy.
    – Svartalf
    May 9 '14 at 19:57












    up vote
    1
    down vote













    You may be able to cobble something together with the MTP porting kit's MTPMon.



    Alternatively, PowerShell can create COM objects and call their methods, so you may be able to use the APIs that Windows Explorer is using (for example, GetDeviceInfo() and GetObjectInfo()).






    share|improve this answer



























      up vote
      1
      down vote













      You may be able to cobble something together with the MTP porting kit's MTPMon.



      Alternatively, PowerShell can create COM objects and call their methods, so you may be able to use the APIs that Windows Explorer is using (for example, GetDeviceInfo() and GetObjectInfo()).






      share|improve this answer

























        up vote
        1
        down vote










        up vote
        1
        down vote









        You may be able to cobble something together with the MTP porting kit's MTPMon.



        Alternatively, PowerShell can create COM objects and call their methods, so you may be able to use the APIs that Windows Explorer is using (for example, GetDeviceInfo() and GetObjectInfo()).






        share|improve this answer














        You may be able to cobble something together with the MTP porting kit's MTPMon.



        Alternatively, PowerShell can create COM objects and call their methods, so you may be able to use the APIs that Windows Explorer is using (for example, GetDeviceInfo() and GetObjectInfo()).







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Dec 11 '13 at 19:57









        Peter Mortensen

        8,326166184




        8,326166184










        answered May 12 '12 at 8:08









        Arnshea

        1193




        1193






















            up vote
            1
            down vote













            There is a proprietary (but still nice) program: MTP Drive (http://www.mtpdrive.com/index.html ) which allows you to "mount" MTP devices as drives in Windows. With some reasonable limitations it does the great job!






            share|improve this answer





















            • 1. Can that synthetic MTP drive be feed to a common drive data recovery tools like EASEUS/Recuva/R-Studio and data be recovered effeciently? 2. Can I use robocopy/other fast data transfer tools to transfer data from that drive to windows native drives(C/D etc.) efficiently?
              – SIslam
              Aug 27 at 13:44

















            up vote
            1
            down vote













            There is a proprietary (but still nice) program: MTP Drive (http://www.mtpdrive.com/index.html ) which allows you to "mount" MTP devices as drives in Windows. With some reasonable limitations it does the great job!






            share|improve this answer





















            • 1. Can that synthetic MTP drive be feed to a common drive data recovery tools like EASEUS/Recuva/R-Studio and data be recovered effeciently? 2. Can I use robocopy/other fast data transfer tools to transfer data from that drive to windows native drives(C/D etc.) efficiently?
              – SIslam
              Aug 27 at 13:44















            up vote
            1
            down vote










            up vote
            1
            down vote









            There is a proprietary (but still nice) program: MTP Drive (http://www.mtpdrive.com/index.html ) which allows you to "mount" MTP devices as drives in Windows. With some reasonable limitations it does the great job!






            share|improve this answer












            There is a proprietary (but still nice) program: MTP Drive (http://www.mtpdrive.com/index.html ) which allows you to "mount" MTP devices as drives in Windows. With some reasonable limitations it does the great job!







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Oct 19 '17 at 15:19









            barbalion

            212




            212












            • 1. Can that synthetic MTP drive be feed to a common drive data recovery tools like EASEUS/Recuva/R-Studio and data be recovered effeciently? 2. Can I use robocopy/other fast data transfer tools to transfer data from that drive to windows native drives(C/D etc.) efficiently?
              – SIslam
              Aug 27 at 13:44




















            • 1. Can that synthetic MTP drive be feed to a common drive data recovery tools like EASEUS/Recuva/R-Studio and data be recovered effeciently? 2. Can I use robocopy/other fast data transfer tools to transfer data from that drive to windows native drives(C/D etc.) efficiently?
              – SIslam
              Aug 27 at 13:44


















            1. Can that synthetic MTP drive be feed to a common drive data recovery tools like EASEUS/Recuva/R-Studio and data be recovered effeciently? 2. Can I use robocopy/other fast data transfer tools to transfer data from that drive to windows native drives(C/D etc.) efficiently?
            – SIslam
            Aug 27 at 13:44






            1. Can that synthetic MTP drive be feed to a common drive data recovery tools like EASEUS/Recuva/R-Studio and data be recovered effeciently? 2. Can I use robocopy/other fast data transfer tools to transfer data from that drive to windows native drives(C/D etc.) efficiently?
            – SIslam
            Aug 27 at 13:44




















            draft saved

            draft discarded




















































            Thanks for contributing an answer to Super User!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.





            Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


            Please pay close attention to the following guidance:


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f369959%2fhow-do-i-access-mtp-devices-on-the-command-line-in-windows%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Plaza Victoria

            In PowerPoint, is there a keyboard shortcut for bulleted / numbered list?

            How to put 3 figures in Latex with 2 figures side by side and 1 below these side by side images but in...