LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

accessing environment variables and windows directory

Hello all:
How can I get the name of the windows directory? Let's say i don't
know if my VI will be used on win 95 or 2000 etc. I don't want to hard
code the path to, say, "c:\winnt". Is there a way to get this
information through an environment variable or the registry? I know
that labview can access the registry, but I don't know which key would
contain this info - if any would. Of course, if I could get
%SystemRoot% I would be sitting pretty.

All help appreciated!

---------------------------
Dan Greenspan
Mail Stop 14-707M
Johns Hopkins University
Applied Physics Laboratory
11100 Johns Hopkins Road
Laurel, MD 20723-6099

240-228-7490
daniel.greenspan@jhuapl.edu
---------------------------
0 Kudos
Message 1 of 5
(3,112 Views)
There is VI in the LabVIEW Windows utilitys called Get Windows Path.vi. I'm having trouble finding the direct link to the file (LVWUtil32.zip), but it can be found at the bottom of this Knowledge Base: http://digital.ni.com/public.nsf/3efedde4322fef19862567740067f3cc/824b3db43031317686256aaf00713218?OpenDocument

This will get the path to the windows directory, there is also a VI called Get System Path.vi that will get the system directory.

I hope this helps.
Brian
0 Kudos
Message 2 of 5
(3,112 Views)
One of the best methods I've found is to use the Windows Script Host COM object. You can call the script host the way you would any other ActiveX server and query it for the path to any of the Windows "Special" Folders including the desktop, My Documents, etc. The script host object is present on all Win 98 and higher and also installs with IE5, so its usually present on Windows machines.
Message 3 of 5
(3,112 Views)
The Windows API conatins functions that allow you to get the path of any system folder. I have written a vi which accesses these APIs for you. Have fun! The VI is called get folder path and takes a numeric argument and returns the appropriate path. An Excel file (included in the zip file) explains the constants to use to get the Desktop folder, Windows folder, system folder, etc. It's Operating System Version-Independent!
Message 4 of 5
(3,112 Views)
Excellent vi, thanks John. If anyone has a vi to register an activex control without using RegSvr32.exe I'd appreciate it.
0 Kudos
Message 5 of 5
(3,112 Views)