Un exemple :
Code powershell : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31 $items = Import-Csv -Path ".\monfichier.csv" -Delimiter ";" -Encoding Default $indexMax = $items.count for($ii = 0; $ii -lt $items.count; $ii++ ) { $item = $items[$ii] $index = $ii $percent = $index * 100 / $indexMax Write-Progress -Activity "Copie" -Status "$($percent.ToString("0.##")) % : $($item.source)" -PercentComplete $percent if (Test-Path -Path $item.source -PathType Container) { if (!(Test-Path -Path $item.destination -PathType Container)) { New-Item -Path ($item.destination) -ItemType "directory" | Out-Null } $Error.Clear() Copy-Item -Path ($item.source + "\*") -Destination $item.destination -Recurse -ErrorAction SilentlyContinue if ($Error.Count -ne 0) { $Error.Exception.Message | Out-File -FilePath ".\error.log" -Append -Encoding default } } } Write-Progress -Activity "Copie" -Completed






Répondre avec citation




Partager