LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Using System exec.vi to run devcon and wait for a device to be seen by device manager

I am running devcon with System exec.vi and using the "standard output" to read the response, but the trouble is, it works fine when I run cmd as an administrator manually and I can read the output, but when I run the same command with labview system exec.vi , devcon seems to open another cmd window and runs in it and then close quickly resulting in a blank output. I don't know how to run cmd as an administrator pragmatically.

I would appreciate if someone has an example code of running devcon with system exec.vi and getting a response in the  "standard output" to be used to make a decision using labview.

0 Kudos
Message 1 of 8
(3,453 Views)

wire an indicator to the output of system exec.vi. This will capture the output

 

Hope it helps

Please remember to accept any solutions and give kudos, Thanks


LV 8.6.1, LV2010,LV2011SP1, FPGA, Win7
0 Kudos
Message 2 of 8
(3,447 Views)

Thanks Akiel for your reply, yes I am wiring the output to an indicator but the response is not the same string that I get when I run CMD as administrator manually and then type the command. It responds with "C:\windows\System>More?" instead of the name of the device found in device manager.

0 Kudos
Message 3 of 8
(3,433 Views)

Have you got system exec.vi set to wait for execution to finish (one of the booleans)?

Please remember to accept any solutions and give kudos, Thanks


LV 8.6.1, LV2010,LV2011SP1, FPGA, Win7
0 Kudos
Message 4 of 8
(3,425 Views)

There is an example on the community here:

 

https://decibel.ni.com/content/docs/DOC-15561

 

Don't know if you have seen this?

Ian S
Applications Engineer CLA
National Instruments UK&Ireland
0 Kudos
Message 5 of 8
(3,402 Views)

Hi, when we try running a command line, which we have already used in CMD (command prompt), one thing we have to make sure:
To use a command that must be executed directly from a command prompt window, insert "cmd /c" before the command.

 

Taken from LabVIEW help.


I am not allergic to Kudos, in fact I love Kudos.

 Make your LabVIEW experience more CONVENIENT.


0 Kudos
Message 6 of 8
(3,395 Views)

We used to do something like that to determine if a device was connected, but now we do it without devcon.

See attached VI.

"If you weren't supposed to push it, it wouldn't be a button."
0 Kudos
Message 7 of 8
(3,382 Views)

did you fix the problem?? How did you do it?

0 Kudos
Message 8 of 8
(2,845 Views)