명령줄을 사용하여 iPhone에서 파일을 어떻게 복사합니까?

명령줄을 사용하여 iPhone에서 파일을 어떻게 복사합니까?

CtrlWindows + C, Ctrl+ 를 사용하여 V모든 파일을 내 PC에 복사하는 대신 명령줄을 사용하여 iPhone의 파일에 액세스하고 싶습니다 .

"This PC" 또는 다른 라인을 네트워크 드라이브로 매핑할 수 있는지 알아보았지만 방법을 찾을 수 없습니다.

아래와 같이 명령줄(대부분 DOS 스타일 명령 프롬프트)을 사용하여 iPhone 폴더를 복사하려고 합니다.

이 PC는 I폰에 있다

답변1

타사 소프트웨어를 피하고 싶다면,파워셸com 개체를 사용하여 shell.application가상 폴더 및 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

모든 디렉토리에는폴더객체와폴더 항목그와 관련된 객체입니다. .Self및 속성을 사용하여 서로 참조할 수 있습니다 GetFolder.

       |--------> Folder.Self ------->|
    Folder                         FolderItem
       |<--- FolderItem.GetFolder <---|

참고자료:

관련 정보