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: 

"file/directory info" of file .lnk

When i use "File/Directory Info" with a file .lnk, a local link, Labview attempts to gather info about the linked file. For example if i have "link to C.lnk", it returns info about C:\. How do i get info about the link itself, i mean the little .lnk file?
0 Kudos
Message 1 of 7
(3,423 Views)
Hi Snamproge,

Actually I tried to get the info of a .lnk file and gave the correct path (where the .lnk file was stored) manually to the path control and it gave me the right info. But I was not able to select the file using the file dialog box in the control. Doing so actually refers to the target and not the link file. Probably just entering the path manually and ensuring that its the right path(right click and see general properties of the link ) will solve your problem.

Hope it helps.

Kallis
BR
0 Kudos
Message 2 of 7
(3,418 Views)
Hi,

I'm not going to be able to solve your problem, but I just wanted to say I had a similar problem in the past.

While writing a recursive file tree program I wondered why one directory kept repeating itself.  I finally located a *.lnk file which was pointing to the parent directory.  Voilà.  LV kept looping thinking that there were ever-deeper directories there.

The only way I found of getting around it (apart from Windows calls) was to simply ignore *.lnk files........

Not great I realise but it's all I came up with at the time.

Another method is to create a small batch program to list the *.lnk files in a directory and parse the output to a file which can then be read and analysed.  Windows itself has no problems with lnk files.

Shane.
Using LV 6.1 and 8.2.1 on W2k (SP4) and WXP (SP2)
0 Kudos
Message 3 of 7
(3,408 Views)
In LabVIEW 8.0, the FIle/Directory Info function has two outputs that can help identify shorcuts. They are the "shortcut" and "resolved path" outputs. "shortcut" is true if the path passed in is to a shortcut (ex. text.lnk). "resolved path" returns the path to the shortcut target. The size and last mod infomation is still to the file pointed to by the shortcut, though. These new outputs help the recursive problem since you can test to see if the path is to a shortcut and ignore it.
George M
National Instruments
0 Kudos
Message 4 of 7
(3,398 Views)

I'm using Labview 7.1 on Windows and i know paths are correct... What's your version, Kallis?

To tell the whole story, my program too examines the contents of directories, and i discovered this problem because i had a link to A:\ (the floppy disk) somewhere. It hanged the program because a "insert disk" window popped up!!

0 Kudos
Message 5 of 7
(3,391 Views)
Hello Snamproge,

Actually I was using LV 8.0. Don't have LV 7.1 right now with me to try out. When  I created a shortcut of my CD drive with no CD in it and tried to use the Get Dir Info VI, it returned an error. But it worked properly with my local drive shortcuts.

If you don't want to examine the info of a .lnk file, why don't you put a check before passing the file name to the Get Dir/file info VI.

Kallis
BR
0 Kudos
Message 6 of 7
(3,381 Views)
I noticed that it works here too for links to local hard drives! But i bet it doesn't work on Lab 8 too for links to files Smiley Happy
Unless i do like shoneill said, i guess the only solution in pure Labview is to copy the .lnk files to temporary files with different extension and get info from the copies...
0 Kudos
Message 7 of 7
(3,373 Views)