powershell循环语句:依次读取某文件名并赋给变量,然后将该变量带入一条命令进行执行;。变量:value。

需要执行的命令:Import-RecipientDataProperty -Identity "value" -Picture -FileData ([Byte[]]$(Get-Content-Path "D:\value.JPG" -Encoding Byte -ReadCount 0))

给你写个例子:

$filelist=dir xxxx #获取文件列表
foreach($file in $filelist){
$filename=$file.fullname
Import-RecipientDataProperty -Identity $filename -Picture -FileData ([Byte[]]$(Get-Content-Path "D:\value.JPG" -Encoding Byte -ReadCount 0)) #做处理

xxxxx #表达式
}
温馨提示:答案为网友推荐,仅供参考
相似回答