📎 AI Summary:
The thread discusses how to automate clearing unnecessary shortcuts from the Windows 7 Start Menu. The original poster is interested in creating a batch file to delete all items except specified ones, but the responses suggest using manual deletion from specific directories or customizing the Start Menu through settings. A solution involving PowerShell scripting is provided, illustrating a more automated approach to remove unwanted shortcuts while preserving specified files. The overall sentiment indicates that while manual methods work, using PowerShell offers a straightforward way to automate the process.

PeterSchmitz

New Member
Member details
Joined
Apr 17, 2017
Messages
8
Thread Author #1
Hi everyone,

after doing a clean Windows 7 reinstall I was wondering if there is a way to quickly clear the Start Menu Folder
by writing a Batch file.
I only know how to delete a single entry via the "reg delete <Path>" command however this only works if you add the name of the specific Program you want to clear.
The Batch file should clear everything in the Start Menu Folder leaving only Programs that have been specified.

Thanks in advance,
Peter
 

Solution
It would be pretty simple in powershell. Something like this.
Code:
$filePaths = @("$env:USERPROFILE\Appdata\Roaming\microsoft\windows\start menu","$env:ProgramData\microsoft\windows\start menu")
$excludeItems = @("file1tokeep","file2tokeep")
$filesToRemove = Get-ChildItem -Path $filePaths -Exclude $excludeItems -Recurse -File
foreach($file in $filesToRemove) { Remove-Item -Path $file.FullName -Force }

Neemobeer

Windows Forum Team
Staff member
Member details
Joined
Jul 4, 2015
Messages
8,995
Depends, which items do you want to remove? Regular start menu items, recent opens, pinned?
 

PeterSchmitz

New Member
Member details
Joined
Apr 17, 2017
Messages
8
Thread Author #3
Just anything that is is not necessary, I thought that I could write a file and in that file define which Programs should be left in the Start Menu.
 

Neemobeer

Windows Forum Team
Staff member
Member details
Joined
Jul 4, 2015
Messages
8,995
You can right click on the taskbar, select propeties > 'Start Menu' and customize what you want shown on the start menu. As for removing program shortcuts it would be quick to just delete them from the two locations they are populated from.
  • Press [Windows key + r]
  • Type shell:start menu
  • Delete whatever shortcuts in here you do not want in the start menu
  • Press [Windows key + r]
  • Type shell:common start menu
  • Again delete what you don't want shown (this is the all users location)
 

PeterSchmitz

New Member
Member details
Joined
Apr 17, 2017
Messages
8
Thread Author #5
Yep, thats what I have done so far. I was just wondering if anyone knows of a way to have a batch file do the clearing for me. I would have that file lying on my Desktop and then just double click on it and the start menu is cleared.
That's nothing I need necessarily but it would be cool. I am just too inexperienced with shell programming on Windows etc.
On Linux I would be able to do this but I do not know the MS-DOS commands needed on Windows.
 

Neemobeer

Windows Forum Team
Staff member
Member details
Joined
Jul 4, 2015
Messages
8,995
It would be pretty simple in powershell. Something like this.
Code:
$filePaths = @("$env:USERPROFILE\Appdata\Roaming\microsoft\windows\start menu","$env:ProgramData\microsoft\windows\start menu")
$excludeItems = @("file1tokeep","file2tokeep")
$filesToRemove = Get-ChildItem -Path $filePaths -Exclude $excludeItems -Recurse -File
foreach($file in $filesToRemove) { Remove-Item -Path $file.FullName -Force }
 

Solution