Clear Windows Start Menu with Batch?

PeterSchmitz

New Member
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
 

Neemobeer

Windows Forum Team
Staff member
Depends, which items do you want to remove? Regular start menu items, recent opens, pinned?
 

PeterSchmitz

New Member
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
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
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
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 }
 
Top