?
Solved

Killing Process Using Batch Script

Posted on 2010-01-12
26
Medium Priority
?
1,035 Views
Last Modified: 2012-05-08
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
Comment
Question by:CalmSoul
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 6
  • 6
  • +2
26 Comments
 
LVL 5

Expert Comment

by:fhillyer1
ID: 26295306
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
 
LVL 38

Expert Comment

by:Shift-3
ID: 26295370
The image name has to go immediately after the /im switch.  Try this.


taskkill /f /t /im wowexec.exe

Open in new window

0
 
LVL 5

Author Comment

by:CalmSoul
ID: 26295539
No is its not working Shift-3 I am running script as administrator
0
NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

 
LVL 5

Author Comment

by:CalmSoul
ID: 26295545
there is a space in front of process name... I am sure that is causing an issue.
0
 
LVL 56

Expert Comment

by:Bill Prew
ID: 26295811
You might try this, including the space in front of the taskname.       

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

~bp
0
 
LVL 5

Author Comment

by:CalmSoul
ID: 26295855
still doesn't work.
0
 
LVL 56

Expert Comment

by:Bill Prew
ID: 26295948
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
 
LVL 35

Assisted Solution

by:Joseph Daly
Joseph Daly earned 400 total points
ID: 26295982
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
 
LVL 35

Expert Comment

by:Joseph Daly
ID: 26296018
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
 
LVL 56

Expert Comment

by:Bill Prew
ID: 26296087
Try this:

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

~bp
0
 
LVL 38

Expert Comment

by:Shift-3
ID: 26296089
What error are you getting?
0
 
LVL 5

Author Comment

by:CalmSoul
ID: 26296220
Didn't work guys.. I run the batch file no error comes up. Screen blinks and go away.
0
 
LVL 5

Author Comment

by:CalmSoul
ID: 26296229
There is no PID accosciated to process.
0
 
LVL 35

Expert Comment

by:Joseph Daly
ID: 26296268
Have you tried the command I mentioned

wmic process where name='wowexec.exe' call terminate
0
 
LVL 56

Expert Comment

by:Bill Prew
ID: 26296325
I think wowexec *may* be a 16 bit program (vague memory?), could it be running under ntvdm.exe?

~bp
0
 
LVL 56

Expert Comment

by:Bill Prew
ID: 26296356
So I think you want to kill ntvdm.exe, and it will take wowexec.exe with it...

~bp
0
 
LVL 35

Expert Comment

by:Joseph Daly
ID: 26296460
Wowexec is a 16 bit process. If BP is right try the following

wmic process where name='ntvdm.exe' call terminate
0
 
LVL 56

Expert Comment

by:Bill Prew
ID: 26296491
Of course this should work too.

taskkill /f /t /im ntvdm.exe

~bp
0
 
LVL 5

Accepted Solution

by:
fhillyer1 earned 1600 total points
ID: 26296736
taskkill /F /IM ntvdm.exe /T

remember the order
0
 
LVL 5

Expert Comment

by:fhillyer1
ID: 26296745
0
 
LVL 5

Author Comment

by:CalmSoul
ID: 26296809
Still can't get it killed. Any other way guys?
0
 
LVL 35

Expert Comment

by:Joseph Daly
ID: 26296864
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
 
LVL 5

Author Comment

by:CalmSoul
ID: 26296987
I can right click and end process from gui.
0
 
LVL 5

Expert Comment

by:fhillyer1
ID: 26297626
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
 
LVL 5

Expert Comment

by:fhillyer1
ID: 26297642
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
 
LVL 5

Expert Comment

by:fhillyer1
ID: 26297650
if you can just provide the screen just like i sent it DOS CMD, TASK MGR
0

Featured Post

Enroll in August's Course of the Month

August's CompTIA IT Fundamentals course includes 19 hours of basic computer principle modules and prepares you for the certification exam. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

YESTERDAY YESTERDAY.BAT is inspired by a previous article I wrote entitled: TOMORROW.BAT (http://www.experts-exchange.com/OS/Microsoft_Operating_Systems/MS_DOS/A_4196-Advanced-Batch-File-Programming-TOMORROW-BAT.html). The crux of this batch f…
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Suggested Courses

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question