iffile "lockfile.txt" goto lockfile_exists ; Lockfile does not exist, so ; create one and begin processing writefile "lockfile.txt" "processing" ; Add script processing here ; Processing is done, so ; remove lockfile and exit delete "lockfile.txt" :lockfile_exists ; If lockfile exists skip processing ; and exit. exit