Thread: Batch file help
View Single Post
Old 14th January 2021, 23:34   #1
Junior Member
Join Date: Jan 2021
Posts: 3
Batch file help

My apologies if this has been covered. I couldn't find it via search.

I would like to create a simple batch file (not plugin) which PLAYS winamp if it gets stopped, paused, or otherwise not playing. I am not a coder. I managed to cobble together one that opens winamp and plays it, but not one that can restart it if it pauses/stops while open. I don't know enough about code for the IF/THEN commands. Any help would be appreciated.

Windows 10. Winamp V 5.8

@ECHO off
SET _PollingInterval=30

"C:\Program Files (x86)\Winamp\Winamp" /PLAY

:: PING -n %_PollingInterval% >nul
TIMEOUT /T %_PollingInterval%

FOR /F "tokens=2 delims= " %%i IN ('TASKLIST ^| FIND /i "subapp.exe"') DO SET PID=%%i
IF [%PID%]==[] (
ECHO Application was not running. Restarting script.
GOTO BatchStart
GOTO Start

Wadle is offline   Reply With Quote