2

The recycle bin doesn't show up when you type it into the start menu which seems incredibly moronic. I am able to create a shortcut and pin it to the start menu so it shows up, but I'd like to automate it for the next time I install Windows 10.

Is there a way to automate this using PowerShell, Batch, or VBS?

I tried with PowerShell, but it says access is denied. Even when run as admin.

$shell = New-Object -ComObject "Shell.Application"
$StartMenuProgramsFolder = [Environment]::GetFolderPath("StartMenu")
$folder = Join-Path -Path $StartMenuProgramsFolder -ChildPath "Programs"
$folder = $shell.Namespace($folder)
$item = $folder.Parsename("test.lnk")

$verb = $item.Verbs() | Where-Object {$_.Name -eq '&Pin to Start'}

if ($verb) {
    $verb.DoIt()
}

Creating a shortcut in the shortcut folder and restarting explorer.exe doesn't automatically pin it to the start menu anymore either.

2

1 Answer 1

0

This code worked for me :

$objShell = New-Object -ComObject ("WScript.Shell")
$objShortCut = $objShell.CreateShortcut($env:USERPROFILE + "\Start Menu\Programs\" + "\Recycle Bin.lnk")
$objShortCut.TargetPath = "C:\Windows\Explorer.EXE"
$objShortCut.Arguments = "shell:RecycleBinFolder"
$objShortCut.IconLocation = "C:\PATH\recycle-bin.ico"
$objShortCut.WorkingDirectory = "C:\Windows\System32"
$objShortCut.Save()

You will need to find and use above an .ico icon that you like.

2
  • That creates a shortcut, but it does not pin it to the start menu.
    – John
    Commented Mar 24 at 23:31
  • You can pin the shortcut if you wish.
    – harrymc
    Commented Mar 25 at 9:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .