Parsing properties in Link- and Internet Shortcut files -- SOLVED for Windows 10
roland.huettmann at gmail.com
Fri Feb 12 17:11:05 EST 2021
Tested on Windows 10:
I now found and tested the batch file script that works now:
Create a batch file, for example "GetURL.bat"
Edit the file with a text editor (Notepad++ or whatever)
Put the following script into this file:
:: START OF SCRIPT -- comment line
setlocal enableextensions enabledelayedexpansion
for %%F in (%1\*.url) do (
call :findurl "%%~dpnxF"
for /f "tokens=2 delims==" %%i in ('findstr URL %1') do set url=%%i
:: END OF SCRIPT -- comment line
Save the file and place it for this demo in the C:\folder (which is
accessible for admins only. Otherwise use a "documents/..." folder.
When calling the .bat file here we assume that the .bat file is in the C:\
...Calling from Windows CMD opened with Administrator rights:
C:\GetURL.bat "C:\Users\<your username>\Desktop\Links"
This assumes that there is a folder "Links" on the desktop containing the
Internet shortcut file (hidden file extension .url) and that you want to
read the content of the URL plus the filename.
-- Now, we can call the .bat file from LiveCode with a little script in a
# Example script to call the .bat file:
set the hideconsolewindows to true
put "C:\GetURL.bat" into tCmd -- Calling the commands in the .bat file
put "C:\Users\Rolan\Desktop\Links" into tFolder -- The folder containing
Internet Shortcut files .url
put tCMD && tFolder into tCommand
put shell (tCommand) into msg --x Could be messages box or any field...
-- Example output in the message box (a list of .url files with the
content of their url)
The script in the .bat file looks at all files with a .url extension in the
folder specified and returns the name and the URL content of that file.
Each record is separated by three "---".
C:\Users\Roland\Desktop\Links\simultaneous multiple database access -
C:\Users\Roland\Desktop\Links\Sons of Thunder Software - Developer
Resources - LiveCode.url
C:\Users\Roland\Desktop\Links\Sons of Thunder Software - Products.url
Please, if there is anything for Mac (OSX) and Linux, we could publish this
in the Forum.
P.S: I will also check how to read the local .ink files that are shortcuts
to files and folder in Windows. It should also be possible using this for
More information about the use-livecode