Skip to content

Instantly share code, notes, and snippets.

@siuoly
Created January 30, 2022 18:43
Show Gist options
  • Save siuoly/7aaac214e1f4d8fa3a745a41eecaf964 to your computer and use it in GitHub Desktop.
Save siuoly/7aaac214e1f4d8fa3a745a41eecaf964 to your computer and use it in GitHub Desktop.
window10, WSL play music, WSL撥放音樂

command: explorer.exe music.mp3

上述缺點是不夠輕量,希望在cmd 一行命令撥放音樂。

若要在用linux程式撥放音樂,需要設定硬體驅動程式的讀取,會非常麻煩。 microsoft/WSL#5816 https://www.reddit.com/r/bashonubuntuonwindows/comments/hrn1lz/wsl_sound_through_pulseaudio_solved/

附註: windows11 WSL 好像已經解決此問題。 microsoft/WSL#5816 (comment)


在這裡,解決辦法是: 下載: mpg123, 找到download/win64/1.29.3/ 64位元版本。解壓縮檔案。

測試撥放音樂: 拖曳音樂檔案到mpg123.exe。成功繼續下個步驟

複製 mpg123.exe 到 c:windows\System32 資料夾。後續使用,cmd當中呼叫命令mpg123 audio.mp3即可撥放音樂。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment