r/PowerShell • • May 27 '26

Question missing while do loop error

hello! i know nothing about code and I'm just trying to convert some music files so itunes recognizes them, i keep getting an error on the following script

for (%f in (*.wav *.mp3 *.ogg)) {do {ffmpeg -i "%f" -b:a 128k -ar 44100 "%~nf_new.mp3"}}

the error is as follows

At line:1 char:88

+ ... .mp3 *.ogg)) {do {ffmpeg -i "%f" -b:a 128k -ar 44100 "%~nf_new.mp3"}}

+ ~

Missing while or until keyword in do loop.

+ CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException

+ FullyQualifiedErrorId : MissingWhileOrUntilInDoWhile

knowing nothing about programming I have no idea how to fix it or what to add. please help!

0 Upvotes

16 comments sorted by

View all comments

Show parent comment

1

u/ankokudaishogun May 29 '26

But you should really not be posting code you don't understand.

I would disagree. That's exactly the kind of code to post, otherwise how could one get help to understand it?

Now, not running code one doesn't understand is another matter.

1

u/Zozorak May 29 '26

Yeah that was a typo on mobile... You get the gist of what I was trying to say at least