In a loop I'm trying to concatenate two strings to be used as progressbar name to set (for each progressbar) the maximum value (from a counter):
My progressbar names are $progressbarDesktop, $progressbarFavorites, etc...
Code: Select all
$folders = @("Desktop", "Favorites", "Documents", "Pictures", "Music", "Downloads", "Videos")
foreach ($Folder in $folders)
{
$count= (Get-ChildItem -File -Path "C:\Users\John Doe\$folder" -recurse -attributes !H | Measure-Object).Count
$progressbar = '$progressbar' + $folder
$progressbar.Maximum = $count
}
How can do in a loop ?
Thanks for your help ! (despite my bad english)