小编boi*_*ink的帖子

PowerShell复制失败,没有警告

你好,我试图将文件从IE缓存复制到其他地方.这适用于w7,但不适用于Vista Ultimate.

简而言之:

copy-item $ f -Destination"$ targetDir"-force

(我也试过$ f.fullname)

完整的脚本:

$targetDir = "C:\temp"
$ieCache=(get-itemproperty "hkcu:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders").cache

$minSize = 5mb
Write-Host "minSize:" $minSize
Add-Content -Encoding Unicode -Path $targetDir"\log.txt" -Value (get-Date)

Set-Location $ieCache
#\Low\Content.IE5 for protected mode
#\content.ie5 for unprotected

$a = Get-Location 

foreach ($f in 
        (get-childitem -Recurse -Force -Exclude *.dat, *.tmp | where {$_.length -gt $minSize})
        )
        {           
        Write-Host (get-Date)   $f.Name $f.length       
        Add-Content -Encoding Unicode -Path $targetDir"\log.txt" -Value $f.name, $f.length
        copy-item $f -Destination "$targetDir" -force
        }
Run Code Online (Sandbox Code Playgroud)

智慧的终结.请帮忙!

powershell copy-item

4
推荐指数
2
解决办法
2621
查看次数

标签 统计

copy-item ×1

powershell ×1