CalmSoul
asked on
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
taskkill /f /im /t wowexec.exe
tskill wowexec.exe /a /v
processes.png
The image name has to go immediately after the /im switch. Try this.
taskkill /f /t /im wowexec.exe
ASKER
No is its not working Shift-3 I am running script as administrator
ASKER
there is a space in front of process name... I am sure that is causing an issue.
You might try this, including the space in front of the taskname.
taskkill /f /t /im " wowexec.exe"
~bp
taskkill /f /t /im " wowexec.exe"
~bp
ASKER
still doesn't work.
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
~bp
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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
wmic process where name='notepad.exe' call terminate
and on a remote machine
wmic /node:{computername} process where name='notepad.exe' call terminate
Try this:
for /f "tokens=2" %%a in ('tasklist ^| findstr wowexec.exe') do taskkill /f /t /pid %%a
~bp
for /f "tokens=2" %%a in ('tasklist ^| findstr wowexec.exe') do taskkill /f /t /pid %%a
~bp
What error are you getting?
ASKER
Didn't work guys.. I run the batch file no error comes up. Screen blinks and go away.
ASKER
There is no PID accosciated to process.
Have you tried the command I mentioned
wmic process where name='wowexec.exe' call terminate
wmic process where name='wowexec.exe' call terminate
I think wowexec *may* be a 16 bit program (vague memory?), could it be running under ntvdm.exe?
~bp
~bp
So I think you want to kill ntvdm.exe, and it will take wowexec.exe with it...
~bp
~bp
Wowexec is a 16 bit process. If BP is right try the following
wmic process where name='ntvdm.exe' call terminate
wmic process where name='ntvdm.exe' call terminate
Of course this should work too.
taskkill /f /t /im ntvdm.exe
~bp
taskkill /f /t /im ntvdm.exe
~bp
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
also this question is related to another on EE
https://www.experts-exchange.com/questions/23619106/Close-WOWEXEC-and-NTVDM.html
https://www.experts-exchange.com/questions/23619106/Close-WOWEXEC-and-NTVDM.html
ASKER
Still can't get it killed. Any other way guys?
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.
ASKER
I can right click and end process from gui.
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
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
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
please
if you can just provide the screen just like i sent it DOS CMD, TASK MGR
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