1.

Solve : How to make batch file execute as a singleton??

Answer»

Hi,

I have a Talend (ETL software) job that is launched using a BAT FILE every day at 01:00 a.m. This batch should be able to be run manually. But on manual run, if it is already running, I have to display an error message to the Administrator and prevent him from running it. Typical singleton requirement.
Can someone please help me out with how to do this on DOS ?if you set the window TITLE in the batch e.g.

Code: [Select]title MyTitle
you can use tasklist with the /v (VERBOSE) switch to FIND if a window with that title is already running

Code: [Select]title NotMyTitle
tasklist /v | find "MyTitle">nul && goto skip
title MyTitle

[i]your code[/i]

goto end

:skip
echo Batch file is already running!
PAUSE
:end
exit



Discussion

No Comment Found