LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

query Windows for current 'user' directory

Solved!
Go to solution

the system will have multiple users, test records are to be saved to the c:\Documents and Settings\<user>\Application Data\Pacing System\

      how do I determine this path for various users dynamically?

Lawrence M. David Jr.
Certified LabVIEW Architect
cell: 516.819.9711
http://www.aleconsultants.com
larry@aleconsultants.com
0 Kudos
Message 1 of 4
(4,930 Views)

Try this 😉

 

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 2 of 4
(4,923 Views)

Use the Default Data Directory VI found in "Functions >> Programming >> File I/O >> File Constants"

 

 

Use Strip Path and Build Path accordingly...

0 Kudos
Message 3 of 4
(4,915 Views)
Solution
Accepted by topic author lmd2

I like the "Get System Directory" vi found in the File Constants subpalette of the File I/O palette.  It might be LV2009 only.

 

18047iAAA9DA816F927CC3

 

Note that the Application Data directory is hidden by default in win7.  In win7 x64 this returns "C:\Users\<user>\AppData\Local\Pacing System\"  In XP, it's "C:\Documents and Settings\<user>\Local Settings\Application Data\Pacing System\"

 

Yamaeda's registry approach gives me "C:\Users\<user>\AppData\Roaming"  Querying the "LOCALAPPDATA" or the "USERPROFILE" keys are also close to what you want.  If XP doesn't have these keys, you could also call a command line and query the %userprofile% environment variable.

 

@Phil: I've had trouble with the "Default Data Directory" vi before (yesterday in fact).  It depends on an options setting within labview.  (Options>Paths),  I found that when I change this path in the options to use the system directory (uncheck "use default", click the exclamation point button, click on replace, then OK out of options), it gets reset to the default value when labview is restarted, even though it shows up in Labview.ini. This only happens if you use the system-specific path.  It appears to be an old problem:http://forums.ni.com/t5/LabVIEW/Custom-default-data-directory-path-reverts-to-Labview-default/m-p/36...

-Barrett
CLD
Message 4 of 4
(4,899 Views)