设置PDF文件的只读

时间:2016-08-29 11:20:29

标签: powershell pdf

目前,我的只读函数不设置PDF文件的只读。

function SetFolderItemsReadOnly{
    Param([string]$Path)
    $files = Get-ChildItem $Path -File -ErrorAction SilentlyContinue
    foreach($file in $files) {
        Set-ItemProperty -Path $file.FullName -Name IsReadOnly -Value $true

    }
}

如何为pdf文件执行此操作?

1 个答案:

答案 0 :(得分:0)

在get-childitem和set-itemproperty中使用-literalpath

学分:@wOxxOm