Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How does one add entries to the Windows 7 start menu for All Users programatically? For example I might want to add the folder MyApps containing a shortcut to myapp.exe and a URL for

Ideally I'd like to do this in a batch file but I'll take VBScript or PowerShell as well please.

share|improve this question
Keep in mind that your program will have to run with elevated permissions to write to those folders. – Zoredache Feb 14 '12 at 17:28

To add entries to the All Programs portion, merely include a shortcut under the folder %AllUserProfile%\Microsoft\Start Menu\Programs.

You can use the SpecialFolder object in VBScript.

Not sure how to do it in Powershell, but this is it in Javascript:

var shell = WScript.CreateObject("WScript.Shell");
var allUserProfilePath = shell.SpecialFolders("CommonPrograms");
var myShortcut = shell.CreateShortcut(allUserProfilePath + "\\myShortcut.lnk");
myShortcut.TargetPath = "c:\\My Programs Path";
myShortcut.WorkingDirectory = "c:\\Blah";
myShortcut.WindowStyle = 4;

The translation to VB is straight forward

Dim shell 
Set shell = WScript.CreateObject("WScript.Shell")
Dim allUserProfilePath 
Set allUserProfilePath = shell.SpecialFolders("CommonPrograms")
Dim myShortcut 
Set myShortcut = shell.CreateShortcut(allUserProfilePath + "\myShortcut.lnk")
myShortcut.TargetPath = "c:\My Programs Path"
myShortcut.WorkingDirectory = "c:\Blah"
myShortcut.WindowStyle = 4
share|improve this answer

There are functions in VB and PS to target system folders like the All Users Desktop, All Users Start Menu, etc.

In VBscript you'll want to use SpecialFolders and in PowerShell use Environment Variables.

The following is a snip of code I use to call a function DeleteFile, and pass it the location of a file on the AllUsersDesktop:

DeleteFile (objShell.SpecialFolders ("AllUsersDesktop") & "\Microsoft Word 2010.lnk")
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.