LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Closing windows command line using libraries

Solved!
Go to solution

I tried to run the command as you said, but it returns this error mesage 

err.png

 

Maybe I made a mistake writting the command you said, what do you think?

0 Kudos
Message 11 of 20
(2,188 Views)

Yes, there is a mistake.

Why did you write the bolded stuff: taskkill /FI Símbolo del sistema eq cmd/c bla bla bla ?

You should write exactly as I have showed in the prior post. with "*" and make sure after taskkill there is a space in between taskkill and /F

 

I think you should write exactly the following: taskkill /FI "windowtitle eq Símbolo*" /F 

0 Kudos
Message 12 of 20
(2,185 Views)

I wrote it like that because I have undertood the message like this: taskkill\FI "(title of the window I want to close) eq (my command)" \F.

So then I have to write the code as taskkill /FI "windowtittle eq (tittle of the window I want to kill)*" /F.

I tried it writting what you said but the error remains.

 

0 Kudos
Message 13 of 20
(2,169 Views)

https://technet.microsoft.com/en-us/library/bb491009.aspx

 

 

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 14 of 20
(2,165 Views)
Solution
Accepted by topic author kibkib

Try with this: taskkill /im cmd.exe

 

Probably there is an issue with accents as you have your computer in spanish.

0 Kudos
Message 15 of 20
(2,134 Views)

Okay, so you are saying to refer to the command window as an image, interesting I will try it. 

0 Kudos
Message 16 of 20
(2,118 Views)

@kibkib wrote:

Okay, so you are saying to refer to the command window as an image, interesting I will try it. 


Taskkill: Ends one or more tasks or processes. Processes can be killed by process ID or image name.

 

That is why I set the command window title in my example

 

 

 

Anyway the part I want you to see is I set the window title of the Iperf window with the "title Client" line in the batch file. This is important as you will see below. 

 

To kill the running Iperf I use the taskkill command, notice that taskkill need the window title of the task you are killing.tkill.png

That says taskkill /FI "windowtitle eq Client*"

 

The only caveat I have ran into is taskkill can not kill a task that is ran as Administrator, seemingly even if my executable is ran as Administrator. I am guessing even if the LabVIEW executable is ran as Administrator, the systemexec is still running at lower privileges? So if someone has messed with Windows UAC (like I found on several machines on our lab) and set console windows to always run as Administrator, taskkill will fail.

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 17 of 20
(2,106 Views)

 taskkill /im cmd.exe is working, but it closes the cmd window instantaneously. And as I explained before I need to close the window moreless in 10 seconds. It is posible to do what I want using timers or something like that?

0 Kudos
Message 18 of 20
(2,090 Views)
Solution
Accepted by topic author kibkib

Delay your calling of the SysExec that runs taskkill. 

 

The simplest way to do this would be to use a Wait (ms) node with a constant and a Flat Sequence structure passing through an error wire or similar.

 

In 2017, there's a VIM called (I think) Delay Data Flow that does the same thing.

 

If you need other things to happen during that 10s, you can consider better structuring your code to allow a delay then the kill command. A State Machine might help you there, as could a Producer/Consumer design.


GCentral
Message 19 of 20
(2,087 Views)

I used the VIM you mentioned and it works, im able to delay the clossing the time I want.

The name of the VIM is stall data flow

thanks for your help! My programm now runs automatically from the start to the end!

0 Kudos
Message 20 of 20
(2,080 Views)