Video Screencast Help
Protect Your POS Environment Against Retail Data Breaches. Learn More.

Creating a SendTo Shortcut Through MSI

Created: 28 Mar 2012 • Updated: 19 May 2013 | 1 comment
Language Translations
piyushnasa's picture
+3 3 Votes
Login to vote

If you want to create a SendTo shortcut through MSI, then if you just add the shortcut in MSI in SendTo folder, it will not work. Even if you get the shortcut there in every user profile, still it will not work. To make a SendTo shortcut, you need to create it on the fly, which means that shortcut should be created from original exe. To solve this issue for one of my application, WinSCP, I wrote the below VBScript and placed it in %ALLUSERPROFILE%\WinSCP folder. Then I created an Active setup to call this VBScript.

Set Shell = CreateObject("WScript.Shell")
ShortcutPath = Shell.SpecialFolders("SendTo")
Set link = Shell.CreateShortcut(ShortcutPath & "\WinSCP (for upload).lnk")
link.Arguments = "/upload"
link.Description = "WinScp"
link.HotKey = ""
link.IconLocation = "C:\Program Files (x86)\WinSCP\WinSCP.exe,0"
link.TargetPath = "C:\Program Files (x86)\WinSCP\WinSCP.exe"
link.WindowStyle = 3
link.WorkingDirectory = "C:\Program Files (x86)\WinSCP"
link.Save

To delete this SendTo shortcut, I wrote another script and added an active setup registry key through CA during Remove sequence to run this script.

dim filesys
Set filesys = CreateObject("Scripting.FileSystemObject")
Set oShell = CreateObject("WScript.Shell")
sup = oShell.ExpandEnvironmentStrings ("%APPDATA%")
WinSCPlnk= sup & "\Microsoft\Windows\SendTo\WinSCP (for upload).lnk"
If filesys.FileExists(WinSCPlnk) Then
   filesys.DeleteFile WinSCPlnk
End If

Also remember to make the above component as permanent, because you do not want to delete this vbs file at uninstall of application.

Comments 1 CommentJump to latest comment

balasm's picture

Hi Piyush, Could you please give more explanation on shortcut delition part? Thanks in advance.

0
Login to vote