Browse files on camera using PowerShell

后端 未结 3 926
[愿得一人]
[愿得一人] 2020-12-15 09:20

If I connect my digital camera via USB, Windows Explorer lists it under Computer as a device. I can browse it using Explorer, see folders, file properties etc, and copy/dele

相关标签:
3条回答
  • 2020-12-15 10:08

    You can combine information from the two following articles: https://devblogs.microsoft.com/powershell/get-usb-using-wmi-association-classes-in-powershell/

    This will allow you to retrieve the device ID associated with your specific USB device (from the Name property, for example).

    Then use WMI for accessing the files: How can I create a PowerShell script to copy a file to a USB flash drive?

    0 讨论(0)
  • 2020-12-15 10:08

    I'd start by running get-PSDrive and see if the camera shows up.

    If it does, you should be able to treat it as a normal drive and use the copy-item cmdlet to move the items:

    Reference: http://technet.microsoft.com/en-us/library/dd347638.aspx

    regards Arcass

    0 讨论(0)
  • 2020-12-15 10:13

    I have just created a PowerShell script that is able to crawl my usb attached Android device, derived from the following website:

    http://blogs.technet.com/b/heyscriptingguy/archive/2013/04/26/use-powershell-to-work-with-windows-explorer.aspx

    I am using the following APIs:

    1. Instantiation of a Shell.Application COM object:

    $o = New-Object -com Shell.Application

    1. Get a specific Namespace, i.e. the list of root folders:

    $folder = $o.NameSpace(0x11)

    0x11 refers to the enum constant ShellSpecialFolderConstants.ssfDRIVES; see https://msdn.microsoft.com/en-us/library/windows/desktop/bb774096(v=vs.85).aspx

    1. Recursively traverse this $folder:

    $folder.GetFolder() and $folder.Items

    See my complete working gist: https://gist.github.com/cveld/8fa339306f8504095815

    0 讨论(0)
提交回复
热议问题