use*_*665 6 iphone command-line windows-10
我想使用命令行访问iPhone上的文件,而不是使用windows ++Ctrl将所有文件复制到我的PC上。C CtrlV
我查看了是否可以将“这台电脑”或任何其他行映射为网络驱动器,但我找不到如何映射。
按照下面的 O 意图,使用命令行(最有可能是 DOS)复制批次。
如果您想避免使用第 3 方软件,PowerShell可以使用shell.applicationcom 对象来访问虚拟文件夹和 MTP 设备。这是一个简单的复制脚本:
$pcDestinationPath = 'C:\Wherever\You\Want'
$phoneRelativePath = 'Internal Storage\DCIM'
$shell = New-Object -com shell.application
$PhoneFolder = ($shell.NameSpace("shell:MyComputerFolder").Items() | where Type -match 'Mobile Phone|Portable Device').GetFolder
### To access a subfolder, you have to "walk" its path
$SourceFolder = $phoneRelativePath.Split('\') |
ForEach-Object -Begin {
$comFolder = $PhoneFolder
} -Process {
Try
{
$comFolder = ($comFolder.Items() | where {$_.IsFolder} | where Name -eq $_).GetFolder
}
Catch
{
Write-Error 'Failed to parse $DeviceFolderPath'
}
} -End {
$comFolder
}
### Get comFolder object for $pcDestinationPath
If ( ! (Test-Path $pcDestinationPath) )
{
mkdir $pcDestinationPath -Force | out-null
}
$pcDestinationFolder = $shell.NameSpace($pcDestinationPath)
### Option 1: Copy $SourceFolder as a single item
$pcDestinationFolder.CopyHere($SourceFolder.Self)
### Option 2: Copy *the contents of* $SourceFolder as a collection of items
$pcDestinationFolder.CopyHere($SourceFolder.Items())
### Option 3: Copy selected items from $SourceFolder individually
$SourceFolder.Items() | where {<Test-Expression(s)>} |
ForEach-Object {
$pcDestinationFolder.CopyHere($_)
}
### FolderItem properties available for testing:
### - IsFolder
### - IsLink
### - ModifyDate
### - Name
### - Parent
### - Path
### - Size
### - Type
Run Code Online (Sandbox Code Playgroud)
每个目录都有一个与之关联的Folder对象和FolderItem对象。.Self它们可以通过和属性相互引用GetFolder:
|--------> Folder.Self ------->|
Folder FolderItem
|<--- FolderItem.GetFolder <---|
Run Code Online (Sandbox Code Playgroud)
参考: