Pin shortcut (.lnk) to start menu

I'm currently making an installation script by using a .cmd file. Here is my code:

IF EXIST "%USERPROFILE%\Desktop\Opslag\Opslag.hta" (

START "" "%USERPROFILE%\Desktop\Opslag\Opslag.lnk" /secondary /minimized
MSG "%USERNAME%" The program is already installed.

) ELSE (

START "" "%USERPROFILE%\Desktop\Opslag\Opslag.lnk" /secondary /minimized
MSG "%USERNAME%" Setup is complete!

The %SOURCE% and %DESTINATION% are set earlier in the script.

When the folder has been copied I want the file %USERPROFILE%\Desktop\Opslag\Opslag.lnk to be added to the Start Menu.

I have seen earlier posts like: How to pin to start menu using PowerShell, but I cannot make it work.

I'm currently testing it on my home laptop which runs Windows 7 with danish language. The machine where I need to do this runs Windows 7 with english language. Therefore I think the $verb is different from the scripts I've found, but I haven't tested on my work station.

Furthermore my work station has a very limited UAC, and therefore I do not have Administrator rights. And please do not comment on how this should not be done by users, but only Administrators/IT, as I know what I'm doing.

I hope someone can help me pin the Opslag.lnk to the Start Menu, preferably on both languages (danish and english).


Find the location of the Start Menu folder:

For /f "tokens=3*" %%G in ('REG QUERY "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" /v "Start Menu" ^|Find "REG_"') do Call Set _startmenu=%%H
echo %_startmenu%

In another search I stumbled across a very usefull VBScript:

Set objShell = CreateObject("Shell.Application") 
Set objAllUsersProgramsFolder = objShell.NameSpace(CSIDL_COMMON_PROGRAMS) 
strAllUsersProgramsPath = objAllUsersProgramsFolder.Self.Path 
Set objFolder = objShell.Namespace(strAllUsersProgramsPath & "\Accessories") 
Set objFolderItem = objFolder.ParseName("Calculator.lnk") 
Set colVerbs = objFolderItem.Verbs 
For Each objVerb in colVerbs 
    Wscript.Echo objVerb 

The script lists alle the verbs for the specifik program, in this case the Calculator. Unfortunately the verb "Pin to Start Menu" in my Opslag.lnk is not listed, and therefore I do not think this can be done with verbs. Hope some one else has other ideas.

I used a .vbs to do this in the current profile (and used the registry, runonce to launch the .vbs on all (new)userprofiles). We are working with both Dutch and English devices in our company so you will see that it will try both languages. The problem is that it did not work on a .lnk but you can always create an exe referring to your desired destination.

Dim strFolder, strExecutable
Set objShell = CreateObject("Shell.Application")

strFolder = "C:\Tools"
strExecutable = "Tool.exe"

Set objFolder = objShell.Namespace(strFolder)
Set objFolderItem = objFolder.ParseName(strExecutable)

Set colVerbs = objFolderItem.Verbs

'Loop through the verbs and if PIN is found then 'DoIt' (execute)
blnOptionFound = False
For Each objVerb In colVerbs
   If Replace(, "&", "") = "Aan het menu Start vastmaken" Then
      blnOptionFound = True
   End If

For Each objVerb In colVerbs
   If Replace(, "&", "") = "Pin to Start Menu" Then
      blnOptionFound = True
   End If

Need Your Help

How can I get all (non-final) object vals and subobject vals using reflection in Scala?

scala object reflection members

Note: This question is not a duplicate of How can I get all object vals and subobject vals using reflection in Scala?

Images & Hyperlink Borders - Ghost 1px x 1px Border

html css border firefox-3

I've an image that is wrapped in an anchor tag that, through jQuery, triggers an action somewhere else on the page. When I click on the image, two tiny 1px by 1px boxes show up in the upper and lo...