Monday, November 5, 2007

Enable Target and Change Icon of shortcuts

Have you tried to right click on a shortcut and found that Target text box is locked, disabled and grayed out? You have also seen that Open File Location is disabled.

Have you wanted to change icon of a shortcut just to find that the Change Icon button for the shortcut is disabled?

Have you tired to Run as administrator and you cannot find it on the right click menu and on Advanced Properties the checkbox cannot be checked?

When I drag a file and drop it on the shortcut it does not launch the program, why is that?

Often I have found this is the case and been irritated about. A typical user case is that you have an AutoCAD shortcut or some other shortcut that you want to take a copy of and add some command line arguments or switch like /p for starting with a specific profile. Depending on the installer sometimes the desktop shortcut is editable but not the shortcut on the Start menu>All Programs.

The solution is not so much help if you have the product installed so this tip is more useful for the IT manager or the CAD manager.

If you have the product already installed it's probably easiest to locate the EXE executable and make a shortcut manually.

Not long ago I found that this is called "advertised shortcuts" and for example Visual Studio installers creates that as default. It can also be set in tools like Wix, InstallShield, Tarma, etc.

Solution or workaround.

You can run a msi file disabling this behavior using
msiexec.exe <path to msi-file> DISABLEADVTSHORTCUTS=1
or
setup.exe DISABLEADVTSHORTCUTS=1

Or you can set it permanently in the MSI file using the free Orca.

If you want to do this more automated it's possible to use a post build event in Visual Studio and then update the MSI file. Included with the Windows Installer SDK there is WiRunSql.vbs that can be used for this purpose. The SQL look like this:
INSERT INTO Property(Property, Value) VALUES ('DISABLEADVTSHORTCUTS ', '1')

Open the MSI file with Orca and add a new row to the Property table use the name DISABLEADVTSHORTCUTS and the value 1.

Now when installing the shortcuts will behave like expected.

From the Windows Installer Guide on MSDN: DISABLEADVTSHORTCUTS Property.

How to use post build with MSBuild to create non-advertised shortcuts.

Advertised shortcuts.

But what is "advertised shortcuts" and when can this be useful?

This can be useful when deploying applications via GPO (Group Policy Object).

Advertised shortcuts ensures that the shortcuts always have an icon, even if users move from machine to machine. The advertised shortcuts also trigger the installation of an application missing on the machine where the user is currently active. More about advertisement.


Some of the latest blog posts

Subscribe to RSS headline updates from:
Powered by FeedBurner