小编tbu*_*n12的帖子

将 EXIF DateTaken 设置为文件创建时间

我正在尝试使用 powershell 修复照片的元数据。我需要将 exif DateTaken 设置为文件 CreationTime

这是我的代码:

[reflection.assembly]::loadfile( "C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Drawing.dll")
echo "--------"
echo ""
$files = Get-ChildItem E:\Photos\*.*
ForEach ($file in $files) {

        #Get Date
    $foo=New-Object -TypeName system.drawing.bitmap -ArgumentList $file.fullname 
    $date = $foo.GetPropertyItem(36867).value[0..9]
    $arYear = [Char]$date[0],[Char]$date[1],[Char]$date[2],[Char]$date[3]  
    $arMonth = [Char]$date[5],[Char]$date[6]  
    $arDay = [Char]$date[8],[Char]$date[9]  
    $strYear = [String]::Join('',$arYear)  
    $strMonth = [String]::Join('',$arMonth)   
    $strDay = [String]::Join('',$arDay)  
    $DateTaken = $strDay + "/" + $strMonth + "/" + $strYear


        # Get Time
    $time = $foo.GetPropertyItem(36867).value[11..18]
    $arHour = [Char]$time[0],[Char]$time[1]
    $arMinute = [Char]$time[3],[Char]$time[4]  
    $arSecond = [Char]$time[6],[Char]$time[7]  
    $strHour = [String]::Join('',$arHour) …
Run Code Online (Sandbox Code Playgroud)

powershell exif

2
推荐指数
1
解决办法
7472
查看次数

标签 统计

exif ×1

powershell ×1