For Programmers: Free Programming Magazines  


Home > Archive > Matlab > November 2005 > killing a process









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author killing a process
n o s p a m p l e a s e

2005-11-27, 7:04 pm

I am running matlab on WinXP Pro. I have a loop that executes a DOS
command and starts another application as follows:

for i=1:100
dos('xyz.bat');
pause(5)
end

Batch file xyz.bat starts another application. After execution the
application must close before it again starts in the loop.
Unfortunately sometimes it does not close itself. I know the process
name and it is rsim.exe.

Is it possible to issue a dos coomand to kill process rsim.exe? If so,
how?

Sebastian Hölz

2005-11-27, 7:04 pm

I have currently had the same problem ...

If you are running XP Pro you may use the (dos-) commands 'tasklists' and 'taskkill' to analyze currently running processes and kill them. However you should notice that theses commands are only available under XP Pro. The according 'tasklist.exe' and 'ta
skkill.exe' are not portable to WIN2000 or WINNT computers!

So if you want your code to be more portable you should instead use the pstools (http://www.sysinternals.com/Utilities/PsTools.html), which are freely available, offer the same functionality and should run on all Windows platforms (I use them under Win200
0 and XP).

I have written Matlab wrappers for pslist (= tasklist) and pskill (= taskkill), but have not put them onto the file-exchange server yet. I will do that next w, don't have the time right now. So help yourself on the above webpage or wait a few days ...
:)

Sebastian
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com