You've got to be kidding me with that syntax. Here's the script in Perl:
$input = <STDIN>;
chdir "~/Desktop";
system("yt-dlp -x --audio-format mp3 $input");
And have you seen errors in powershell? Bill Lumbergh would like such a verbose report, not me.