I'm new and have never done any coding or scripting in my life before and I'm trying to make a batch file that will...
- check to see if itunes is running
- if it is running, open a vbs file for my playlist
- if it is not running, open itunes
- wait 30 seconds
- recheck again until it is able to launch the vbs
- then stop checking
I'm planning on putting this in my startup folder so that when I open my computer up it will start playing music from the start...
But having no coding experience whatsoever I've pretty much only been able to Google search other peoples' solutions and try them blindly in hopes that they work...
so far ive found and tried
@echo off PATH=C:\Program Files\iTunes\iTunes.exe iTunes.EXE YourProgram.exe >nul if ERRORLEVEL 1 goto Process_NotFound :Process_Found echo iTunes is running goto END :Process_NotFound echo iTunes is not running Itunes.exe goto END :END
@echo off tasklist /FI "IMAGENAME eq iTunes.exe" | find /i "iTunes.exe" IF ERRORLEVEL 2 GOTO LOOP2 IF ERRORLEVEL 1 GOTO LOOP1 :LOOP1 start notepad.exe goto EXIT :LOOP1 start iTunes.exe goto EXIT :EXIT
tasklist /FI "IMAGENAME eq iTunes.exe" /FO CSV > search.log FOR /F %%A IN (search.log) DO IF %%~zA EQU 0 GOTO end start iTunes.exe :end
When I test them, the first bat does nothing at all, the second one just opens a blank notepad whether or not iTunes is running, and the third saves a text file to my desktop named "search" and depending on whether iTunes is running or not it changes what search has inside.
INFO: No tasks are running which match the specified criteria.
- If iTunes is off
"Image Name","PID","Session Name","Session#","Mem Usage" "iTunes.exe","7208","Console","1","105,512 K"
- If iTunes is running
It seems this last one is the closest to what I need but I still have no idea how to alter that and change it to what I need.
Can you guys help me out here?