My name is Philipp C. Heckel and I write about nerdy things.

Posts Tagged / Windows


  • Aug 07 / 2014
  • 4
Code Snippets, Programming, Scripting

Snippet 0x05: Windows .bat: Checking if process is running by PID file

Batch (.bat) files are an MS-DOS legacy technology and I don’t know a single person who loves writing them — and yet, to this day, many people have to do it. In order to run Java programs, start daemons or check if a process is running, batch files have to be used. For my open source file sync tool Syncany, I had to do just that:

The Syncany daemon runs in the background and is started by a batch script. To check if the daemon is already running, the batch script needs to read a PID file and determine if a process with this PID is running.

Since it took me an enormeous amount of time to figure out how to do that (I am a Linux guy!), I wanted to share that little script in this code snippet.

Continue Reading