Forum Discussion

rm1954's avatar
rm1954
Copper Contributor
Feb 08, 2022

Passing parameters to an .exe program in a powershell loop

I am a complete newcomer to powershell.  I’m not sure if this is the proper forum for powershell novices who are not IT professionals to get help, but I’m giving it a try.    I’m trying to build a ...
  • Harm_Veenstra's avatar
    Harm_Veenstra
    Feb 08, 2022

    rm1954 
    You could try setting the argument (-t) as a variable, so 

    $xdir = “e:\checking_music_collection_for_errors\10_000_Maniacs\(1993)_Mtv_Unplugged\”
    $files = Get-ChildItem $xdir *.flac -recurse
    $parameters="-t"
    foreach ($f in $files){
    echo  = $f.FullName    
    flac.exe $parameters $f.FullName 
    }

Resources