Question: I'm trying to write a batch that checks how many instances of the process "example.exe" are running, and if there are two or more instances, leave it running. But if there is only one instance running, end the process. Here's what I have:

```
@echo off
wmic process where name="example.exe" | find "example" /c > %temp%\variable.txt
set /p value=<%temp%\variable.txt
if %value% lss 2 goto endprocess
if %value% gtr 1 goto continue
:endprocess
start taskkill /f /im example.exe
:continue
ECHO continue
@echo off

```

My issue is this: It always thinks value is lss 2 (it thinks there are less than 2 instances of the process running). However, in my task manager, I can see that there is obviously 2 instances running. I think it's an issue with defining the value maybe? I don't know, I'm quite new to this. Any help? Thanks!

UPDATE

Okay I've now changed it to this (suggested by Magoo)

```
@echo off
wmic process where name="example.exe" | find "example" /c > "%temp%\variable.txt"
set /p value=<"%temp%\variable.txt"
if %value% equ 1 goto endprocess
if %value% neq 1 goto continue
:endprocess
start taskkill /f /im example.exe
:continue
ECHO continue
@echo off

```

This still doesn't exactly work, but i changed the number of instances from 1 to 0 and it ended the process. In other words, 1 process was running, but this batch file thought that 0 were running. Any ideas now?

Answer: 
Simply return [204 No Content](http://en.wikipedia.org/wiki/List_of_HTTP_status_codes#2xx_Success) answer from your view.
You can achieve this by send ajax request to your server .  

Here you need to write a ajax request which will execute django view and return response into json, xml format .  

You can display latest data into your template as per your need.  

Ajax request

```

function mail_check() {
var val = $("#val").val();
$.getJSON('/test/'+val+"/",

function(data) {
// render changes content     
});}

```

Django view

```

def checkemailavailability(request, val):
    message = {'result':''}
    if request.is_ajax():
        # put logic here
        #json = simplejson.dumps()   convert data into json
        return HttpResponse(json, mimetype='application/json')

```

Note : do not forget to include [jquery](http://jquery.com/)  

Links : [stackoverflow](https://stackoverflow.com/questions/16814425/need-a-simple-working-ajax-example-for-django-forms), [tangowith django](http://www.tangowithdjango.com/book/chapters/ajax.html) , [bradmontgomery.net](https://bradmontgomery.net/blog/a-simple-django-example-with-ajax/)