Jump to content

How to kill System Exec?


Recommended Posts

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

Link to comment

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. :)

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.