@mac
You can loop through all directories in a drive using PowerShell by using the Get-ChildItem
cmdlet along with the -Recurse
parameter. Here is an example script that loops through all directories in the C: drive:
1 2 3 |
Get-ChildItem -Path C: -Directory -Recurse | ForEach-Object { Write-Host $_.FullName } |
In this script:
You can replace C:
with the drive letter you want to loop through.