LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

determine the current directory

Hello,
 
Is there a way to determine the current working directory?
I try to write an executable named LVdiff, similar to the LVMerge.exe in "..\National Instruments\Shared\LabVIEW Merge". My Version control software gives relative paths. "Open VI Reference" opens relative Paths relative to the calling VI and not relative to the directory the executable was started in.
Can anybody help?
 
Greetings,
shb
 
0 Kudos
Message 1 of 8
(3,421 Views)

Hi shb,

you can use the "current vi´s path" and build the correct path to your vi.

Mike

Message 2 of 8
(3,417 Views)

Hi Mike,

I would like to kow the path where the executable is STARTED in.

Example:

I open a shell and type "cd C:\Data"
I am in "C:\Daten" now
Now I execute: "C:\Program Files\MyProgram\Run.exe" My.png
The absolute path to the VI is "C:\Data\My.png" and not C:\Program Files\MyProgram\My.png"

How can the executable know that it was started in "C:\Data"?

Greetings,
shb

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

shb,

Look at this thread and my AppPath.vi (picture and vi included in the thread): http://forums.ni.com/ni/board/message?board.id=170&message.id=292248#M292248

-cb

0 Kudos
Message 4 of 8
(3,396 Views)
Hi cb,
 
I know this useful tipp the thread is about. But it is about the path the executable (or VI) ist STORED, but how do I know from which directory the application is CALLED?
 
0 Kudos
Message 5 of 8
(3,386 Views)

There's an Application class property called Directory Path which does what you want, but I would advise working with the method mentioned before.

You should also look at the rest of that thread, for a better solution:

 

 

However, the better solution in your case would be to do no work at all. If you search Google you should already find a program named LVDiff which does exactly what you want. I don't use it exactly as released, but I don't remember the exact changes I made. If you can't find it, search Sourceforge or the LAVA forums.



Message Edited by tst on 07-23-2008 05:30 PM

___________________
Try to take over the world!
0 Kudos
Message 6 of 8
(3,380 Views)

Ah, I see I midunderstood the question. I would still suggest using the existing LVDiff, but to do what you want in Windows you can call the system exec VI and pass it the command "cmd %cd%". That returns the %CD% environment variable which should be what you want.


___________________
Try to take over the world!
Message 7 of 8
(3,368 Views)
shb,
 
If you are looking for something like the equivalent of the VB function "CurDir" (which returns the current directory), you can call the System Exec.vi as tst suggests but pass it the string "cmd /c chdir" and examine the standard output.
 
-cb
0 Kudos
Message 8 of 8
(3,357 Views)