【问题标题】:Copy-Item Progress Bar复制项目进度条
【发布时间】:2022-10-24 05:46:00
【问题描述】:

我已经设法编写了我的第一个 powershell 脚本,它可以帮助我保持备份管理器和最新状态。它非常简单,符合我的目的。 Neverthanless 我错过了进度条。 我的备份文件夹几乎是 10Gb,很难判断复制的状态。

您能否修改我的脚本以具有进度条?我没有足够的经验来做这件事。

    $basedir = "Z:\Sales\Meyer Turku\NB-1400_1401 - ICON\MTO100 - NB-1400 - KT30 & KT31\04_Engineering\BG_Ceiling Matrix Backup\00. OLD backup"
$today   = (Get-Date).ToString('dd.MM.yyyy')
$location = New-Item -Path $basedir -Type Directory -Name $today

$sourcePath = "Z:\Sales\Meyer Turku\NB-1400_1401 - ICON\MTO100 - NB-1400 - KT30 & KT31\04_Engineering\BG_Ceiling Matrix\*"
$destPath = "Z:\Sales\Meyer Turku\NB-1400_1401 - ICON\MTO100 - NB-1400 - KT30 & KT31\04_Engineering\BG_Ceiling Matrix Backup\00. OLD backup\$today"
Move-Item -Path $sourcePath -Destination $destPath -Force

$sourcePath = "C:\Users\bartosz.gornicki\Desktop\Travel Pack"
$destPath = "Z:\Sales\Meyer Turku\NB-1400_1401 - ICON\MTO100 - NB-1400 - KT30 & KT31\04_Engineering\BG_Ceiling Matrix"
Copy-Item -Path $sourcePath\* -Destination $destPath -Recurse -Force

【问题讨论】:

    标签: powershell copy progress


    【解决方案1】:

    根据Progress during large file copy (Copy-Item & Write-Progress?)尝试替换

    Copy-Item -Path $sourcePath* -Destination $destPath -Recurse -Force
    

    和

    Import-Module BitsTransfer
    Start-BitsTransfer -Source $sourcePath* -Destination $destPath -Description "Backup" -DisplayName "Backup"
    

    【讨论】:

    • 不幸的是没有工作。
    猜你喜欢
    • 1970-01-01
    • 2018-12-23
    • 2023-03-06
    • 1970-01-01
    • 1970-01-01
    • 2012-12-23
    • 2011-08-28
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多