Lukas
Posts: 5
Joined: Wed Feb 26, 2020 2:31 pm

Computer name is not resolved in shortcut name

Hi i want to create shortcut to exe file in target folder with name: Product name - computer name, but ComputerName is not resolved in name of shortcut it's blank.

Reproduction steps:
  • I added shortcut in "Files and Folders". For name i used [|ProductName] - [|ComputerName]. For target i used exe file in target dir.
    When shortcut is created during install process Product name is correctly resolved but computerName is blank.
  • I tried to use solution from this topic viewtopic.php?f=2&t=30486#p81765, i created custom action which should set installer property but with same result. Computer name is still blank. From logs i see that computer name property was resolved to real computer name. I am using version 16.7.
Best regard,

Lukas
Attachments
01.jpg
01.jpg (46.75 KiB) Viewed 2141 times
Catalin
Posts: 6608
Joined: Wed Jun 13, 2018 7:49 am

Re: Computer name is not resolved in shortcut name

Hello Lukas and welcome to Advanced Installer forums,

As you may know, there are two types of Windows Installer properties:

- Formatted properties

- Pseudo-formatted properties

The main differences between them is the following:

- the formatted type is resolved at install time

- the pseudo-formatted type is resolved at build time and the property name is preceded by a pipe character "|"

In your screenshot, you are trying to use the ComputerName property as a pseudo-formatted one - which honestly is the only option, because the "Name" field from the "Edit Shortcut Properties" dialog is of pseudo-formatted type.

However, the ComputerName property that you are trying to use here is resolved at install time, by a system call to GetComputerName function.

This is the reason why your property is not resolved.

A solution to this would be to have a custom action, scheduled after the "Add Resources" ("Custom Actions" page) action group, with its execution time set to "When the system is being modified (deferred)", that will rename the shortcut to your desired value.

Hope this helps.

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Lukas
Posts: 5
Joined: Wed Feb 26, 2020 2:31 pm

Re: Computer name is not resolved in shortcut name

Thank you for your suggestion. It resolved it.

Lukas
Catalin
Posts: 6608
Joined: Wed Jun 13, 2018 7:49 am

Re: Computer name is not resolved in shortcut name

You are always welcome, Lukas!

I am glad everything works as expected now.

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”