Skip navigation

JSI Tip 0766. A better way to prevent more than one instance of an application from running.

In tip tip 760, we prevented an application from starting if it was already running.

Using TLIST, is a better way. Here is a sample AppName.bat:

@echo off
tlist|find /i "appname.exe" > %TEMP%\appname.tmp
for /f "Tokens=1-2*" %%i in (%TEMP%\appname.tmp) do call :run "%%j"
start /wait /D<StartInFolder> \[Other Switches and parameters\] <StartInFolder>\appname.exe
del /q %temp%\appname.tmp
if /i %1=="appname.exe" exit

Hide comments


  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.