@ECHO OFF rem --------------------------------------------------------------------------- rem Write PID Script for the the DATADONTROLLER rem --------------------------------------------------------------------------- set "PRG_DIR=%~dp0" if not "%DC_HOME%" == "" goto gotHome set "DC_HOME=%PRG_DIR%" if exist "%DC_HOME%\bin\DataController.exe" goto okHome cd /d %PRG_DIR%\.. set "DC_HOME=%cd%" cd "%PRG_DIR%" :gotHome if exist "%DC_HOME%\bin\DataController.exe" goto okHome echo The DC_HOME environment variable is not defined correctly echo This environment variable is needed to run this program goto end :okHome if not exist "%DC_HOME%\temp" ( cd %DC_HOME% mkdir temp cd %DC_HOME%\script ) set "_NAME=DataController.exe" wmic process where name="%_NAME%" get processId |findStr /v "ProcessId" |findstr /v "findstr" >"%DC_HOME%\temp\DataControllerPid.temp" :end exit 0