Find existing shortcut file for all user desktops

Got a problem you cannot solve? Try here.
LarryWall
Posts: 1
Joined: Mon Oct 17, 2022 11:18 am

Find existing shortcut file for all user desktops

Postby LarryWall » Mon Dec 12, 2022 3:46 pm

We want to locate the current shortcut links for users on a PC for our app.

Those were installed from Wise installer before we switched to Installaware.
Some users also created their own shortcuts.

Then we want to move or copy shortcut target info to the public desktop

looping thru "Find All Files" result but difficulty using wildcard\get locations we need.
Tried with no success (This SEARCHPATH value returned no result):
Set Localization Variable SEARCHPATH to C:\Users\*\Desktop\OurAppName.lnk
Find All Files in path $SEARCHPATH$ (include subfolders), write result into variable SHORTEXISTPATH
for each Element LOOPSHORTCUTPATH in | delimited Collection of $SHORTEXISTPATH$ do
Next

Issue is I do not know the user profile names to check their desktop
I cannot figure out a combo of wildcard to work.
When I tried this
Set Localization Variable SEARCHPATH to C:\Users\OurAppName.lnk
I get a lot of dummy folders in the result.

Any thoughts?

JohnGaver
Posts: 67
Joined: Mon Feb 05, 2024 6:15 pm

Re: Find existing shortcut file for all user desktops

Postby JohnGaver » Fri Feb 23, 2024 11:41 am

This topic applies to InstallAware Multi Platform as well.

How about this script?

Code: Select all

~InstallAware Clipboard Data~
~Comment~
~{00189BEC-3F7A-4792-BC4C-CBA830B15540}~
~~
~MessageBox~
~{934F300E-411B-4751-89CD-734BC4380855}~
~DIRS~
~$DIRS$~
~0~
~1~
~~
~Next~
~{F4AF7F74-C08A-435A-9EC0-907AD76F1E84}~
~End~
~{EC7DA30A-CAB8-44B6-8E00-E2E0110F34A7}~
~Replace String~
~{7B1B8683-C067-488F-82EF-345C34CF44B7}~
~DIRS~
~|$FOLDER$~
~~
~TRUE~
~TRUE~
~Replace String~
~{D0D8319B-B637-4498-AE63-EC5D3DEAFF5E}~
~DIRS~
~$FOLDER$|~
~~
~TRUE~
~TRUE~
~If~
~{A5FA0A06-A115-46B9-84F7-FEF8446A87AA}~
~DIR~
~0~
~TRUE~
~TRUE~
~Does File/Folder Exist~
~{65891123-2DA5-4756-BC38-EC6746E20329}~
~DIR~
~$FOLDER$~
~FALSE~
~For Each~
~{D0D0491D-6716-431C-81BC-14044AE057DB}~
~FOLDER~
~|~
~$DIRS$~
~Find All Files~
~{889AB1D1-88B0-44C3-A402-5CD870F56176}~
~$PROFILES$\*.*~
~FALSE~
~TRUE~
~DIRS~
~Extract Path~
~{A3B6609A-D660-4274-A03F-604FB150B5BB}~
~PROFILES~
~4~
~Get Folder Location~
~{EDA5BE50-B0C5-4C0F-8E56-DD087F4C31E2}~
~PROFILES~
~19~
~FALSE~


Here's the human readable form, if you can't paste the above directly into your IDE yet:

Get Folder Location System->Profiles Directory into PROFILES
Extract Parent Folder: PROFILES
Find All Files in path $PROFILES$\*.*, write result into variable DIRS
for each Element FOLDER in | delimited Collection of $DIRS$ do
Does Folder Exist $FOLDER$ (get result into variable DIR)
if Variable DIR not Equals TRUE
Replace $FOLDER$| with in variable DIRS
Replace |$FOLDER$ with in variable DIRS
end
next
MessageBox: DIRS, $DIRS$

Tested to ignore files and return only existing paths, and you can check them within for other contents normally.
John Gaver
InstallAware Skunkworks
InstallAware Multi Platform - Liberating DEB/RPM/PKG/MSI(X) into universal native setups!
Get your free copy today - https://www.installaware.com/installaware-multi-platform.htm


Return to “Technical Support”

Who is online

Users browsing this forum: No registered users and 60 guests