【发布时间】:2017-01-27 16:55:07
【问题描述】:
我尝试制作一个脚本来减小文件夹中图像的大小。但我总是收到一条错误消息。 我必须减小同一文件夹和子文件夹中的大小
请您帮忙构建我的脚本吗?
提前谢谢你。
这是脚本:
$source = "U:\TEST\Compression\images"
$exclude_list = "(Imprimerie|Photos)"
$source_listephotos = Get-ChildItem $source -Recurse | where {$_.FullName -notmatch $exclude_list}
foreach ( $source_photos in $source_listephotos ) {
$source_photos
Resize-Image -InputFile $source_photos.FullName -Scale 30 -OutputFile (Join-Path $source $source_photos.Name) -Verbose
}
这里是错误信息:
Exception calling "Save" with "1" argument(s): "A generic error occurred in GDI+."
At C:\windows\system32\windowspowershell\v1.0\Modules\Resize-Image\Resize-Image.psm1:70 char:9
+ $img2.Save($OutputFile);
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : ExternalException
【问题讨论】:
标签: powershell