在PowerShell中重命名扩展名文件错误

在PowerShell中重命名扩展名文件错误,powershell,Powershell,我想更改文件的扩展名。当我从PowerShell ISE执行代码时,它工作正常。但当我在WinPE下执行时,它返回以下错误: + ... Found = $Job | Rename-Item -NewName { $_.Name.Replace('.que','.pro')} + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : Permi

我想更改文件的扩展名。当我从PowerShell ISE执行代码时,它工作正常。但当我在WinPE下执行时,它返回以下错误:

+ ... Found = $Job | Rename-Item -NewName { $_.Name.Replace('.que','.pro')} + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : PermissionDenied: (P:\JOB\FS190723...WQ6BT602-A1.que:String) [Rename-Item], UnauthorizedAccessException + FullyQualifiedErrorId : RenameItemUnauthorizedAccessError,Microsoft.PowerShell.Commands.RenameItemCommand
检查对文件的权限。检查对文件的权限。 Connection Ready P:\JOB\FS190723AG_1062E59622CA_AAA111222-A1.que
[xml]$Config_File = Get-Content .\ConfigUnit.xml
function PRO_JOB {
    if (Check_Connection_PRISM) {
        Write-Host "Connection Ready"
        $Job_Path = $Config_File.Automation_ConfigUnit.Path.JOB_Path
        $Job = Get-ChildItem -Path "$Job_Path\*$b_SN`_$b_MAC*.que"
        Write-Host $Job
        pause
        Write-Host "Rename file .que to .pro"
        $Job_Found = $Job | Rename-Item -NewName { $_.Name.Replace('.que','.pro')}
    }