• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1073
  • Last Modified:

Killing Process Using Batch Script

I am using following command kill a process but its not working.

taskkill /f /im /t wowexec.exe
tskill wowexec.exe  /a /v
processes.png
0
CalmSoul
Asked:
CalmSoul
  • 7
  • 6
  • 6
  • +2
2 Solutions
 
fhillyer1Commented:
is your batch script being run as administrator?

i suggest you to open a cmd window then run your batch and see any echo displayed by the commands to see if there is a problem or a message displayed when you run it
0
 
Shift-3Commented:
The image name has to go immediately after the /im switch.  Try this.


taskkill /f /t /im wowexec.exe

Open in new window

0
 
CalmSoulAuthor Commented:
No is its not working Shift-3 I am running script as administrator
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
CalmSoulAuthor Commented:
there is a space in front of process name... I am sure that is causing an issue.
0
 
Bill PrewCommented:
You might try this, including the space in front of the taskname.       

taskkill /f /t /im " wowexec.exe"

~bp
0
 
CalmSoulAuthor Commented:
still doesn't work.
0
 
Bill PrewCommented:
It could be that it isn't actually a space in front of the wowexec, but some other non displayable character.  Why not get it's process id and kill it by that?

~bp
0
 
Joseph DalyCommented:
Ok lets try this. Im close but im pretty sure Im going to need someone else to help me with this to put it all together.

The following command should get the process ID of your running program

WMIC PROCESS WHERE Name="wowexec" get processid

Then you could use taskkill with the PID switch instead.

taskkill /PID {number} /F /T

I just dont know how to get you the output from the WMIC command piped to the taskkill command.
0
 
Joseph DalyCommented:
No need for the piping. WMIC has the ability to do this natively

wmic process where name='notepad.exe' call terminate

and on a remote machine

wmic /node:{computername} process where name='notepad.exe' call terminate
0
 
Bill PrewCommented:
Try this:

for /f "tokens=2" %%a in ('tasklist ^| findstr wowexec.exe') do taskkill /f /t /pid %%a

~bp
0
 
Shift-3Commented:
What error are you getting?
0
 
CalmSoulAuthor Commented:
Didn't work guys.. I run the batch file no error comes up. Screen blinks and go away.
0
 
CalmSoulAuthor Commented:
There is no PID accosciated to process.
0
 
Joseph DalyCommented:
Have you tried the command I mentioned

wmic process where name='wowexec.exe' call terminate
0
 
Bill PrewCommented:
I think wowexec *may* be a 16 bit program (vague memory?), could it be running under ntvdm.exe?

~bp
0
 
Bill PrewCommented:
So I think you want to kill ntvdm.exe, and it will take wowexec.exe with it...

~bp
0
 
Joseph DalyCommented:
Wowexec is a 16 bit process. If BP is right try the following

wmic process where name='ntvdm.exe' call terminate
0
 
Bill PrewCommented:
Of course this should work too.

taskkill /f /t /im ntvdm.exe

~bp
0
 
fhillyer1Commented:
taskkill /F /IM ntvdm.exe /T

remember the order
0
 
fhillyer1Commented:
0
 
CalmSoulAuthor Commented:
Still can't get it killed. Any other way guys?
0
 
Joseph DalyCommented:
Can you kill the process through the taskmgr gui? Does it stay eneded? If you are running a 16 bit application it will continue to restart.
0
 
CalmSoulAuthor Commented:
I can right click and end process from gui.
0
 
fhillyer1Commented:
i dont know how are you running your system but straight command line works i attached 2 pictures 1 having ntvdm.exe loaded because i opened a 16 bit application that launches it, in a command window
and on another command window i entered the taskkill command

on the second picture you will see that i pressed enter to kill the appl and it actually gave me the message that it worked well
and on the other command window it returned me to the prompt and on task manager no ntvdm.exe is found
1a.JPG
1b.JPG
0
 
fhillyer1Commented:
can you provide us with a sample screenshot on how are you tyoing the command, showing us as well the ntvdm.exe and wowexec under it, also run the command i want to see whats the Echo on the DOS screen when you run the command.

please
0
 
fhillyer1Commented:
if you can just provide the screen just like i sent it DOS CMD, TASK MGR
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 7
  • 6
  • 6
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now