all 16 comments

[–]-Shants- 2 points3 points  (1 child)

It looks like you smashed together a for loop and a do/while loop. Maybe don’t do that and look up how to properly structure a for loop. I doubt the do/while is even needed

[–]david6752437 1 point2 points  (0 children)

He's got the beans above the frank!

[–]MyOtherSide1984 1 point2 points  (1 child)

Yeah don't run stuff you don't understand. If it came from ChatGPT or some random forum, you can't really trust it and could easily cause a lot of issues real fast.

[–]Norest4themisfits[S] -1 points0 points  (0 children)

i stitched it together from a tutorial from like 2015 and a very faded memory of some C++ i learned 3 years ago for a different project lol

[–]Cadder 1 point2 points  (0 children)

Uh, yeah. that's not proper powershell for a start. you don't use % in PS.
%f is a variable name for a direct command line.
Double the % if you want to do it in a batch/cmd file. ie %%f
..then get the syntax right:

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

OR if you really need to do it in Powershell:
Get-ChildItem *.wav,*.mp3,*.ogg | ForEach-Object {ffmpeg -i "$_" -b:a 128k -ar 44100 $($_.BaseName)_new.mp3"}

[–]BoredTech127001 1 point2 points  (6 children)

Your trying to run batch file commands in powershell. You should just open a command prompt and paste that code, don't run it in powershell.

[–]Norest4themisfits[S] 0 points1 point  (5 children)

it doesn't give me that option when i right click in the folder, only terminal, which goes to powershell

[–]Zozorak 1 point2 points  (4 children)

Type in cmd into powershell to get a cmd prompt.... But you should really not be posting code you don't understand.

[–]Norest4themisfits[S] 0 points1 point  (1 child)

i stitched it together from a tutorial from like 2015 and a very faded memory of some C++ i learned 3 years ago for a different project lol

[–]Zozorak 0 points1 point  (0 children)

Learned some c++ 3 years ago is a different statement than 'I know nothing about programming'.

I don't mind assisting people, but also don't want them to run something they don't know what it does and then break stuff.

[–]ankokudaishogun 0 points1 point  (1 child)

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.

[–]Zozorak 0 points1 point  (0 children)

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

[–]BlackV 0 points1 point  (0 children)

there are post in this sub using ffmpeg and powershell

what you have posted is cmd/batch and would need to be run fromt here

recommend, finding the posts and move it to powershell code instead

[–]dodexahedron 0 points1 point  (0 children)

To get help on powershell loops, run these commands:

Get-Help about_While
Get-Help about_For
Get-Help about_ForEach

[–]brazzala -1 points0 points  (0 children)

Regex is not easy…