Forum Discussion
rm1954
Feb 08, 2022Copper Contributor
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 ...
- 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 }
rm1954
Feb 08, 2022Copper Contributor
I should have mentioned that I'm using Powershell ISE, and strangely ordinary Powershell 5.1 behaves differently. Specifically, I am unable to get the flac command to work in ordinary Powershell even if not in a loop.
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
}
- rm1954Feb 08, 2022Copper ContributorHarm_Veenstra's suggestion works. Thanks so much!
- Feb 08, 2022You're welcome! Please mark my reply as solution to mark it as solved