QB64.org Forum
Active Forums => QB64 Discussion => Topic started by: krovit on November 26, 2021, 07:11:07 am
-
I ask you why here is a well of knowledge... :) really... the record joking but it's the truth
and because I've been looking for the solution for days and I can't find it elsewhere...
Do you have, please, idea how to write a batch file (DOS) to extract the complete path of a .LNK (link) file?
(common knowing can also be useful for apps created with QB64...)
-
I'm not certain how one would go about doing such a thing in a DOS-style batch file, but I'm thinking the below should work for a QB64 program:
start
= InStr(s$
, "DATA") + 5
You'll have to use your own LNK file for testing, as trying to upload one simply redirects to the linked file and tries to upload it rather than the *.LNK file itself. :P
If my thinking is right, all LNK files have a "DATA" + CHR$(0) field, followed by the path to what they're linking to, followed by another CHR$(0). With use of INSTR, you should be able to get the information you need just by parsing and extracting that amount of information from the file, like above.
-
Thank you SMcNeill,
the dear old QB64 is versatile is with a little imagination you can do a lot of things.
Unfortunately the encoding of the links follows an almost incomprehensible rule.
Going back is difficult, almost impossible, if you do not know the code with which the link was encrypted.
Incidentally, years ago, with the system suggested by you, with QB I had written a small program that converted a huge DBF database into another format (without losing a comma!).
It was possible because it is possible to identify the DBF encoding rule with ease.