From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Running BAT file with space characters using System Exec

Solved!
Go to solution

I want to query registry key which has space characters in it. To query this, the whole command is enclosed inside quotes, the BAT file works separately but in System Exec.vi it shows "ERROR: The system was unable to find the specified registry key or value." 

This is the command line "HKLM\SOFTWARE\Adobe\Adobe Acrobat". 

0 Kudos
Message 1 of 7
(987 Views)

Why not use the Registry functions available in LabVIEW?

Santhosh
Soliton Technologies

New to the forum? Please read community guidelines and how to ask smart questions

Only two ways to appreciate someone who spent their free time to reply/answer your question - give them Kudos or mark their reply as the answer/solution.

Finding it hard to source NI hardware? Try NI Trading Post
0 Kudos
Message 2 of 7
(981 Views)

As suggested, there are built-in registry VI which you can use.

 

If you still want not to use that, then I suggest you upload more details about what you're actually doing.

 

If I feed the command line REG QUERY "HKLM\SOFTWARE\National Instruments\LabVIEW" into the system exec VI, I get the results in the output.

 

If I put that same command in a bat file and tell the system exec VI to execute that bat file (cmd /c reg.bat and feeding the containing folder to the working directory input), I also get the results.

 

You might need specific permissions, but I ran LV regularly (although it is from an admin account) and it worked. I would expect that for permission issues you would see another error, but that might not be the case.


___________________
Try to take over the world!
Message 3 of 7
(895 Views)

Hi, 

I have other commands to be executed along with this which are all available in a BAT file. 

0 Kudos
Message 4 of 7
(863 Views)

Again, if you want help, you need to post actual details (the bat file, the code, etc.). Like I said, in my simple test, it does work.

 

You can also try doing the same. Start from a simple test which does what I did. Test if that works in a bat file. Test if your own line works in a bat file on its own, etc. See where it stops working and try to figure out there what the difference is.


___________________
Try to take over the world!
Message 5 of 7
(847 Views)
Solution
Accepted by topic author varshinee97

Thanks all for your response. Space was not the issue, I was trying to access a key which is denied. 

0 Kudos
Message 6 of 7
(795 Views)

@varshinee97 wrote:

Thanks all for your response. Space was not the issue, I was trying to access a key which is denied. 


That can absolutely ruin your day!  😄  (Been there, done that.)  Thank you for marking your post as the solution.  I'm sure others will find it helpful.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 7 of 7
(765 Views)