Skip to content

Instantly share code, notes, and snippets.

@27Cobalter
Last active February 11, 2018 11:23
Show Gist options
  • Save 27Cobalter/1868fa5047d796878917ce99ebfb583d to your computer and use it in GitHub Desktop.
Save 27Cobalter/1868fa5047d796878917ce99ebfb583d to your computer and use it in GitHub Desktop.
特定ディレクトリ内のファイルを検索してpeceでセレクトしてWMPで再生するやつ
@echo off
rem pecoをのバイナリをダウンロードしてPATHに追加してhttps://github.com/peco/peco/releases
chcp 65001
:LOOP
for /F "delims=*" %%a in ('where /r "E:\Sound" *.wav *.mp3 *.mp4 ^| peco ') do @set WAVPATH=%%a
if "%WAVPATH%"=="""" goto LOOP
echo 再生中: %WAVPATH%
rem 昔の直接WMPを呼び出していたパターン
rem "C:\Program Files (x86)\Windows Media Player\wmplayer.exe" /play /close "%WAVPATH%"
rem /hiddenをつけるとウィンドウが隠れる
rem "E:\VisualStudio2017\WMPhandler\WMPhandler\bin\Debug\WMPhandler.exe" "%WAVPATH%" /hidden
"E:\VisualStudio2017\WMPhandler\WMPhandler\bin\Debug\WMPhandler.exe" "%WAVPATH%"
set WAVPATH=""
goto LOOP
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment