PowerShell 脚本- [void][Reflection.Assembly]::LoadWithPartialName('System.Drawing');
- forEach ( $file In (dir E:\Test\*.jpg -File) ){
- $image = [System.Drawing.Image]::fromFile($file.FullName);
- try {
- $propItem = $image.GetPropertyItem(0x9003).Value; #0x9003=拍摄时间;0x0132=最后更新时间
- $dateStr = [char[]]$propItem -join '' -replace '\x00$'; #日期字符串
- $dateStr + "`t" + $file.Name;
- } catch {
- "NULL`t`t`t" + $file.Name; #无拍摄日期时回显NULL
- }
- }
- pause
复制代码 结果:
2019:07:11 08:12:18 img002.jpg
NULL img004.jpg
2019:07:11 08:12:32 img100.jpg
2019:07:11 08:11:47 img101.jpg |