I am running devcon with System exec.vi. The problem is, it works well when I run cmd as an administrator manually and I can read the output, using "devcon findall =ports" 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 used an indicator to show the result that is "'devcon' is not recognized as an internal or external command,
operable program or batch file."
I have no idea how to run cmd as an administrator by LabVIEW.
Any advise will be appreciated.
Did you specify the full path to devcon? If not, you must have the directory added to your PATH environment variable.
Run Minimized = TRUE;
Wait Until Completion = TRUE;
devcon is stored in C:\Windows\System32.. It works when I mannually run cmd as administrator. However when I open it with labview, it does not work.
I have attached my vi.
Don't use cmd.exe as the command line input. Use your devcon command instead.
My system doesn't have a devcon file in the system32 directory. If this is a custom application, I would recommend not putting it in system32 folder but rather in a project folder. There may be Windows rules about running applications located in key system directories that require administrator privileges.
I have put devcon into the file that contains my labview program. Based on your suggestion, I put "devcon findall =ports" directly into the command line and left working directory blank.
The post I made here clearly shows all that is needed to run devcon as a command line. You aren't using the system exec correctly.
But even if you are you are running the command line as an administrator, but are you running LabVIEW as an administrator? LabVIEW opens a command prompt (sorta) and will inherit the privileges that it was ran with. As I said there, lowering your UAC if possible run devcon properly.
Hi dude, thank you for your time. Really appreciate.
In you post, I have tried that but it does not work properly for devcon.
I've tested it on several systems and it seems to work fine. Here is the image showing me attempting to remove my DVD drive. You can see it can't actually remove the drive, but the fact that it is trying means it is being called properly.
I know this is a fairly old discussion but I would like to bring it up once more since there has been no clear answer to me yet. Long story to be short, I have tried to use devcon.exe with System Exec.vi in LabVIEW to control some USB devices. After following the following link I am now able to control USB devices when running devcon through the Windows command line (with admin account though).
However, I could not make that work the same way with System Exec.vi in LabVIEW. Each time I tried to run a devcon command I get the error message like "'devcon.exe' is not recognized as an internal or external command,
operable program or batch file."
So I am wondering if there is a solution to that issue.
As you mentioned, this is a really old thread. I would recommend starting a new thread with this question because it will get more exposure and traffic on it. Also, when you make a new post, sharing your code might be helpful to those looking at your issue.
Just a thought: try running LabVIEW as an administrator to see if that changes anything?