Give this script a try, and you’ll see what we mean: Set objShell = CreateObject(“Shell.Application”) The same thing happens if you call the Delete method programmatically instead of automatically deleting the file, that same confirmation box appears. For example, if you right-click a file and choose Delete, a dialog box pops up asking if you want to send the file to the Recycle Bin. That’s because when you invoke a verb, that verb functions exactly the same as if you had chosen the item from the context menu. Set objFolderItem = objFolder.ParseName(“bob.vbs”)Īnd, yes, these verbs are pretty cool, although they aren’t as cool as you might expect. Set objFolder = objShell.Namespace(“C:\Documents and Settings\gstemp\Desktop\Stuff”) Ok, ok, how did we know the ampersand has to be there? Simple: we ran this script, which returns a list of verbs that can be applied to Calc.exe: Set objShell = CreateObject(“Shell.Application”) And that’s not a misprint in P&in to Start Menu the ampersand is part of the command name, and indicates the shortcut key for the item (in this case, the letter i).
How to pin a document to the start menu windows#
Verbs are items that appear on the context menu when you right-click the application icon in Windows Explorer. But hey, it’s just one extra line of code, and the net result is the same: we get hooked up to C:\Windows\System32\Calc.exe.Īfter that we use the InvokeVerb method to pin the application to the Start Menu. Why can’t we just bind directly to the file? Who knows that’s just the way the Shell object is designed. We then use the ParseName method to bind to the actual executable file ( calc.exe). After creating an instance of the Shell object, we use the Namespace method to bind to the folder ( C:\Windows\System32) where Calculator resides. ObjFolderItem.InvokeVerb(“P&in to Start Menu”)Īs you can see, we use the Shell Application object in order to perform this task. Set objFolderItem = objFolder.ParseName(“calc.exe”) Set objFolder = objShell.Namespace(“C:\Windows\System32”) Here, for example, is a script that pins the Windows Calculator ( calc.exe) to the Start Menu: Set objShell = CreateObject(“Shell.Application”) Nothing wrong with that, of course, but if want to really be cool you can pin items to the Start Menu using a script. In Windows Explorer, you can pin an application to the Start Menu by right-clicking the application icon and then clicking Pin to Start Menu.
![how to pin a document to the start menu how to pin a document to the start menu](https://media.gcflearnfree.org/content/55e0941592956f3c3dae3398_07_31_2015/customizingstartmenu_resize_tile.jpg)
In that case you can “pin” the item to the Start menu once pinned, the application will stay on the Start menu forever (or until you unpin it), even if you never use the application. However, there might be an application or two that you always want to appear on the Start menu even if you don’t use the program all that often. Most of the time this works out pretty good after all, the applications you use most often are probably the applications you use most often. Shortcuts that show you up when you click All Programs stay put, and don’t appear or disappear depending on use.) The less you use an application – well, use it or lose, huh? (Incidentally, this refers solely to the application shortcuts that appear when you first click the Start button. For those of you who haven’t bought Windows XP yet (hey, what’s the matter with you we Scripting Guys have families to feed!), by default XP’s Start Menu changes over time: the more you use an application, the more likely it is to appear on the Start Menu. Dragging and dropping is easy but the result is a little slower than simply right-clicking like the registry hack provides.Hey, Scripting Guy! Can I pin a file to the Start Menu by using a script? In all of these examples, Shift + right-clicking a folder’s actual location will give the option to “Unpin from Start Menu.”Ĭreating the file above and merging it with Windows registry is the safest and easiest method of adding a “Pin to Start Menu” option to folders. Then drag upwards to the top of the menu and drop it. You can also drag a folder to the Start button, hold for a moment, and the whole menu will open.
![how to pin a document to the start menu how to pin a document to the start menu](https://www.davidleonard.london/wp-content/uploads/2018/03/Windows10-yet-another-logo.png)
Drag and drop a folder to the Start menuįor the simple user, pin a folder via a drag and drop to the Start button.
How to pin a document to the start menu manual#
Just like the manual registry change, the same “Pin to Start Menu” option is enabled. Navigate to and right-click the registry key at “HKEY_CLASSES_ROOT\Folder\ShellEx\ContextMenuHandlers.”Ĭhoose “New > Key” from the right-click menu and enter “]Ĭhoose to save as a file of any type so we can manually enter the extension.Įnter a name with a “.reg” extension so it will open in the Registry Editor when launched.ĭouble-clicking the file results in a notification ensuring you actually want to make a registry change.Ĭhoose “Yes” to receive a confirmation dialog box.