Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I came up with the batch file below, and it is working great. However, I would like to know if there is a way to code it so that if a program is already running, it would skip it and launch the next one. I hope this makes sense. Any advice would be greatly appreciated.

@echo off    
start "" cmd /c cscript "C:\Users\User\Desktop\Work.vbs"    
start "C:\Program Files\Microsoft Office\Office15" Outlook.exe    
start "C:\Program Files\Microsoft Office\Office15" Lync.exe    
start "C:\Program Files (x86)\Google\Chrome\Application" chrome.exe    
runas /savecred /user:"DOMAIN\User_Adm" "C:\Program Files (x86)\VMware\Infrastructure\Virtual Infrastructure Client\Launcher\VpxClient.exe"    
runas /savecred /user:"DOMAIN\User_Adm" "mmc.exe \"My_Tools.msc\"
share|improve this question
up vote 6 down vote accepted

Here is a example using tasklist to check all running applications for a given name.
Otherwise it starts the program. I'm sure you can adapt it to your needs

tasklist /nh /fi "imagename eq notepad.exe" | find /i "notepad.exe" > nul ||
(start notepad.exe)
share|improve this answer

I implemented tasklist into my script and its working like a charm.
Here it is for anyone else having the same questions as I had.

@echo off
tasklist /nh /fi "imagename eq iexplore.exe" | find /i "iexplore.exe" > nul ||(start Work.vbs)
tasklist /nh /fi "imagename eq outlook.exe" | find /i "outlook.exe" > nul ||(start outlook.exe)
tasklist /nh /fi "imagename eq lync.exe" | find /i "lync.exe" > nul ||(start lync.exe)
tasklist /nh /fi "imagename eq chrome.exe" | find /i "chrome.exe" > nul ||(start chrome.exe)
tasklist /nh /fi "imagename eq VpxClient.exe" | find /i "VpxClient.exe" > nul || runas /savecred /user:"DOMAIN\User_Adm" "C:\Program Files (x86)\VMware\Infrastructure\Virtual Infrastructure Client\Launcher\VpxClient.exe"
tasklist /nh /fi "imagename eq mmc.exe" | find /i "mmc.exe" > nul || runas /savecred /user:"DOMAIN\User_Adm" "mmc.exe \"My_Tools.msc\"
share|improve this answer
@echo off      
tasklist /FI "IMAGENAME eq outlook.exe" | find /i "outlook.exe"      


  start notepad.exe
goto EXIT     

  start outlook.exe 
goto EXIT 

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.