# Batch file kill process



## Erik.

Hello.
i want to make an batch file that can find the process number and kills it.
I use the program tlist.exe to look in dos for all runing programs.
i kill programs whit kill.exe
Now do i want to make something in the batch file that when i open it it opens tlist.exe and the it looks for the program name.
Then i want that the batch file looks what for process number it has and then it must be killed.
I do not have any experiance whit dos.
I know how to make an batch file and how to open kill and tlist.exe in an batch file.

Can someone help me whit an simple script?

Erik


----------



## Erik.

Could someone help me please.


----------



## Squashman

Which Windows Operating system are you running this Batch file on.


----------



## Erik.

Hello,
i use Windows Xp
I want an batch file that can find an process number in the tasklist and kills it.


----------



## Erik.

can someone help me please.


----------



## Dan O

An easier method is to use Task Manager, which does the same thing. Right click the task bar (bottom line) and select Task Manager. Then select the application or process you want to kill and click End button.

I did start working on the batch files and figure out this:

tasklist.exe /fi "imagename eq cmd.exe" /fo "csv" /nh

But I gave up.


----------



## Erik.

Hello.
I have made an vbs script and that works.
Here the script:
Set WshShell = WScript.CreateObject ("WScript.Shell")
WshShell.Run ("C:\Windows\system32\cmd.exe")
WScript.Sleep 400
WshShell.SendKeys "tskill Program name /a"
WshShell.SendKeys "{ENTER}"
Set oWS = WScript.CreateObject("WScript.Shell")
oWS.Run "%comspec% /c echo " & Chr(07), 0, True
WshShell.SendKeys "exit"
WshShell.SendKeys "{ENTER}"
msgbox "This software is provided as is without any guarantees or warranty. I'M NOT RESPONSIBLE FOR ANY CORRECT OR INCORRECT USE OF THIS SOFTWARE. I CAN'T BE HELD RESPONSIBLE FOR ANY DIRECT OR INDIRECT DAMAGE OR LOSS OR ANY CONSEQUENCES CAUSED BY THE USE OF THIS SOFTWARE IN ANY CASE. In addition, even if this software is defective, I'm not under obligation to correct or support it."
'Then' WScript.Quit


----------



## Dan O

Nice, and thanks for sharing it, which is what the forum is about people helpping people.


----------



## Erik.

Hello,
Thanks
i have 1 question left.
How can i make an .exe file from an vbs file?
i had used exe script but that is shareware.
when i have compiled and want to run it you first get an message that i must register and then you can use it thats to much time i made this for everyone so i do not want that the must click at okej and then the program runs.

Does someone know a better program to compile an vbs file to exe and where i can shose an icon?


----------



## Squashman

Erik. said:


> Hello,
> Thanks
> i have 1 question left.
> How can i make an .exe file from an vbs file?


Why do you want to make it into an exe? Doesn't make sense to me. You can encode it if you don't want people to casually see the code.
http://www.microsoft.com/downloads/...67-C447-4873-B1B0-21F0626A6329&displaylang=en


----------



## Erik.

Hello.
i do not want that people can see whati made in to it so the can make some programs for them self.

Thanks for the link.


----------



## HandleX

nice script.


----------



## Squashman

Erik. said:


> Hello.
> i do not want that people can see whati made in to it so the can make some programs for them self.
> 
> Thanks for the link.


So basically what you are saying is that you wanted FREE help to write a script to do something, but you don't want anyone to see the code on how to do it.


----------



## Erik.

Thanks,
i try to explain it to you.
i made 2 programs that do the same.
i made one in vbs file thats for everyone who wants it.
my second one is a .exe file and i made it whit the program autoit.
i do not want that you edit my .exe program.
vbs is free but the .exe i made it at my own so...

i have one more question.
Now do i have the progran in .exe file
Now when you open t you see i dos screen and you see that it does something you see: tskill program name /a 
{ENTETR}
exit

Now do i want that you do not see anything!
like a trojan 
when you have an torjan you do not see that you have one everything runs in the backed of the pc.
How can i made that?


----------

