John Lokanis Posted December 15, 2009 Report Share Posted December 15, 2009 I want to use system exec.vi to run some scripts from the command line. If the script I run crashes and locks up the cmd.exe interface, how can I kill it and get control back to the calling LabVIEW thread? I will be using 'wait until completion' so I can get back the results from my command, so my thread will be stuck until the call returns. thanks for any ideas. -John Quote Link to comment
asbo Posted December 15, 2009 Report Share Posted December 15, 2009 I want to use system exec.vi to run some scripts from the command line. If the script I run crashes and locks up the cmd.exe interface, how can I kill it and get control back to the calling LabVIEW thread? I will be using 'wait until completion' so I can get back the results from my command, so my thread will be stuck until the call returns. thanks for any ideas. -John You can use a notifier/occurrence in parallel with your original SystemExec call which will do a System Exec of taskkill.exe /im "your executable/script/whatever" after a given timeout. So give your Wait on Notifier or Wait on Occurrence whatever timeout you think your call will execute in. There shouldn't be any harm in calling the taskkill if your Wait doesn't time out, but you could code around that anyway. I noticed you said script, specifically - what kind is it, batch, VBScript, JScript? Depending on that, you may have to taskkill whatever engine runs those scripts, rather than "whatever.vbs". For a batch file, it would probably just be taskkill /im "cmd.exe". Unfortunately, I think that's about as elegant as it gets using System Exec. Quote Link to comment
John Lokanis Posted December 16, 2009 Author Report Share Posted December 16, 2009 Thanks. Crude but functional! Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.