这里是 Windows 11。
尝试使用
.mp4
将文件夹中的所有文件(都是
.mp3
文件)转换为
FFMPEG
文件
获取了代码
我目前位于
E:\Downloads2\
文件夹
使用 Windows 命令行 (CMD)时,以下代码有效:
for %f in (*.*) do "C:\FFMPEG\ffmpeg" -i "%f" -vn -acodec libmp3lame -q:a 2 "E:\Downloads2\converted\%~nf.mp3"
但是,当我在 Power Shell 中尝试它时(前面附加了
./
),我收到以下错误消息:
*.* : The term '*.*' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
为什么它在 Power Shell 中不起作用?
显然这是两种不同的语言。 从 powershell 调用 cmd:
cmd /c 'for %f in (*.*) do "C:\FFMPEG\ffmpeg" -i "%f" -vn -acodec libmp3lame -q:a 2 "E:\Downloads2\converted\%~nf.mp3"'
Powershell 会是这样的:
get-childitem *.* | foreach-object {
C:\FFMPEG\ffmpeg -i $_ -vn -acodec libmp3lame -q:a 2 "E:\Downloads2\converted\$($_.basename + '.mp3')" }