Like if it's no open, start the application otherwise bring the application to the front. I already have this script but i need it to bring it to the front:
@echo off
tasklist /FI "IMAGENAME eq TOTALCMD.exe" | find /i "TOTALCMD.exe"
IF ERRORLEVEL 1 start "" "C:\totalcmd\TOTALCMD.execheers && thx noircc
1 Answer
From this topic on Stack Overflow you've got 3 options.
I wouldn't use the options of CMDOW or NirCmd from NirSoft because most virusscanners will trip over those utilities so you are left with 1 option:
I would use AutoHotkey or AutoIt.
To bring a window to the front in AutoHotkey you could use its title:
WinRestore, Untitled - Notepad
WinActivate Untitled - NotepadYou could also follow the script on this page and code everything in AutoHotkey without the need for a batchfile. That way you could use the .exe-filename.
But if this is to code TOTALCMD.exe to only run once...
It does have an option to only allow 1 copy at a time
When selected if you run a second copy the first will become active.