Get VLC player curerent song from windows command line

Dec 7th, 2009

I wasn’t sure it was possible but the following batch script should work. It might have some problems with special characters still… post a comment if you find something wrong with it. I’ll fix it and post the new script.

1
2
3
4
5
6
7
8
9
10
11
12
@echo off
tasklist /FI "IMAGENAME EQ vlc.exe" /v /FO "list" > tempdata
for /F "tokens=*" %%R in ('findstr "Window" tempdata') do set VAR=%%R
set TITLE=Window Title: VLC media player
set VAR=%VAR:|=^|%
set VAR=%VAR:<=^<% set VAR=%VAR:>=^>%
set VAR=%VAR:(=^(%
set VAR=%VAR:)=^)%
IF "%VAR%"=="%TITLE%" GOTO :EOF
set VAR=%VAR:Window Title: =%
set VAR=%VAR: - VLC media player=%
echo %VAR%

PS. It creates the file “tempdata” in the same folder as the batch file. It also wont work if the playlist is focused (or was focused more recently than the main window).

There will be no output if the song is stopped (but if it is just paused it will show the song name).

No comments yet.