Does PB have a way to access a file via a shortcut? FileSize (ShortcutName$) returns -1.
I tried searching the forum and did not find anything helpful.
File shortcut
Re: File shortcut
If I get you right, you have to search for these keywords.
Then you will find this one, among others.
Creating a desktop shortcut
Get the Shortcut target
Code: Select all
CreateShortcut
ShortcutTarget
Creating a desktop shortcut
Get the Shortcut target
Just because it worked doesn't mean it works.
PureBasic 6.04 (x86) and <latest stable version and current alpha/beta> (x64) on Windows 11 Home. Now started with Linux (VM: Ubuntu 22.04).
PureBasic 6.04 (x86) and <latest stable version and current alpha/beta> (x64) on Windows 11 Home. Now started with Linux (VM: Ubuntu 22.04).
Re: File shortcut
You can't get the actual ".lnk" file itself with FileSize(), if that's what you mean. Well, I've never seen or found a way.
Re: File shortcut
Hi,
A very old little program that I have wrote 11 years ago. (just updated)
Doesn't work in every situation, but almost.

A very old little program that I have wrote 11 years ago. (just updated)
Code: Select all
; Extract full program name from lnk file
; (C)Marc56(us) - 2015-11-27
; Updated 2025-04-12
RegEx.s = "^[A-Z]\:\\[\w\d\:\\\s\.()\-]+"
Source_Dir$ = GetUserDirectory(#PB_Directory_Desktop)
If Not CreateRegularExpression(1, RegEx)
Debug "Bad RegEx" : End
EndIf
If ExamineDirectory(0, Source_Dir$, "*.lnk")
While NextDirectoryEntry(0)
If DirectoryEntryType(0) = #PB_DirectoryEntry_File
File_Name$ = DirectoryEntryName(0)
If ReadFile(2, Source_Dir$ + File_Name$)
While Eof(2) = 0
Txt$ = ReadString(2)
If MatchRegularExpression(1, Txt$)
Debug "-" + RSet(File_Name$, 50, ".") + " > [" + Txt$ + "]"
EndIf
Wend
CloseFile(2)
EndIf
EndIf
Wend
FinishDirectory(0)
EndIf

Re: File shortcut
He does not have a shortcut. He cannot get an executable file from the missing shortcut.