亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

PowerShell腳本未壓縮正確的文件

PowerShell腳本未壓縮正確的文件

MMMHUHU 2019-10-12 11:13:20
Function Zip{    Param    (        [string]$zipFile        ,        [string[]]$toBeZipped    )    $CurDir = Get-Location    Set-Location "C:\Program Files\7-Zip"    .\7z.exe A -tzip $zipFile $toBeZipped | Out-Null    Set-Location $CurDir}$Now = Get-Date$Days = "60"$TargetFolder = "C:\users\Admin\Downloads\*.*"$LastWrite = $Now.AddDays(-$Days)$Files = Get-Childitem $TargetFolder -Recurse | Where {$_.LastWriteTime -le "$LastWrite"}$FilesZip C:\Users\Admin\Desktop\TEST.zip $Files我正在測試我在網上找到的腳本。我的問題是,不是壓縮目標文件夾中的文件,而是復制并壓縮7-zip程序文件文件夾的內容。是什么原因造成的?提前致謝
查看完整描述

3 回答

?
白衣染霜花

TA貢獻1796條經驗 獲得超10個贊

將參數設為強制性Param ( [Parameter(Position=0,mandatory=$true)] [string]$zipFile, [Parameter(Position=1,mandatory=$true)] [string[]]$toBeZipped ) 

查看完整回答
反對 回復 2019-10-12
  • 3 回答
  • 0 關注
  • 675 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號