Click here to Skip to main content
15,867,977 members
Articles / Programming Languages / C#

Start Menu Cleaner .NET

Rate me:
Please Sign up or sign in to vote.
4.00/5 (6 votes)
22 Mar 2009Ms-PL2 min read 28.8K   285   24   3
Start Menu Cleaner .NET (fka. Start Menu Cleaner for Windows XP) is a small utility that scans all dead shortcuts and empty folders on your Programs in Start menu. Tested on Windows XP, Vista, and W7

Introduction

A not so very old code submission on CodePlex, it was popular there and already got some reviews on the other site, so I thought of adding it here too. :)

Here's the screen shot, and I intentionally renamed the target files from those shortcuts for the demo since I accidentally deleted them all using that utility I made. I forgot to write the condition where it deletes only the checked items .. but don't worry, that was already fixed ;)

And another one from Windows Vista:

Background

I came across a problem again (I'm a "When there's a problem, I make the solution" guy) where I used a tool WinStep Start Menu Organizer to manage my programs in start menu, and I organize them the way I can easily open them (e.g. my Visual Studio and other Software development programs are in Developer Tools folder) instead of having my programs scattered or sorted and viewed on a 2 or more columns of installed programs.. Yuck! That's a great tool by the way ... BUT!!

Talk about CONS from that tool.. Since I managed them so perfect, the problem sets in when I started to uninstall lots of my unused applications. Why, what is that? You could guess ... DEAD SHORTCUT LINKS! Their Uninstaller left a dead shortcut files in my start menu, because the uninstaller didn't find them and just left them there. Well it's a user's fault. ;)

So just to save my time tracking down those dead shortcuts, I wrote a small utility, an open source and free for all program. Since it grows a bit, I also added a feature to scan empty folders.

Using the Code

Just download the latest release, extract it, and run StartProgramCleaner.exe.

Some code that you might be interested in here is, I used IWshRuntimeLibrary for handling shortcut files, such as getting the Target Path or Description from the shortcut file.

IWshRuntimeLibrary can be found in Windows Script Host Object Model (C:\Windows\System32\wshom.ocx).

Just reference it and use it:

C#
using IWshRuntimeLibrary;

Here's a little code snippet on how to do it:

C#
private static string GetTarget(string shortcut_file)
{
   IWshShortcut shortcut = (IWshShortcut)wsh.CreateShortcut(shortcut_file);
   string t = string.Empty;
   if (shortcut.TargetPath != string.Empty)
   {
      t = shortcut.TargetPath;
   }         
   shortcut = null;
   return t;
}

private static string GetDescription(string shortcut_file)
{
   WshShell shll = new WshShell();
   IWshShortcut shortcut = (IWshShortcut)shll.CreateShortcut(shortcut_file);          
   string d = shortcut.Description;
   shortcut = null;
   return d;
}

Points of Interest

This is from the latest release (which is Release 2).

I didn't know this was working fine in Vista or 7 until I saw some reviews on the internet! Thanks guys! and Thanks to that JUNCTION FOLDERS!

History

  • 22nd March, 2009: Initial post

License

This article, along with any associated source code and files, is licensed under The Microsoft Public License (Ms-PL)


Written By
Founder Capploud
Philippines Philippines
I am an experienced Applications Developer and had worked professionally for over 6 years. I have been writing codes and building different applications for over 13+ years. My work is mostly for Microsoft technologies such as .NET. Yes I am Microsoft technology enthusiast.

My field of expertise in .NET technology are Desktop and Windows Mobile and Windows Phone. I occasionally write ASP.NET too for clients.

I have wide experience of different programming languages and scripts such as: Turbo Pascal, Batch Scripts, C/C++, Visual Basic Classic, Visual Basic .NET, Java, HTML, CSS, ASP Classic, VB Script, ASP.NET, T-SQL, MySQL, PHP, C#, Javascript, jQuery, HTML5, RegEx, XAML, XML, JSON, and XPath

I am also experienced in different platforms such as: Google Data API, Google Map API, Twitter API, Facebook API, Flickr API, Skydrive API, SVN, GitHub, Drupal, and Orchard.

I am interested in Microsoft technologies, User Experience and User Interfaces, Algorithms, Robotics, Astronomy, Architecture, Electrical, Mechanics, and Extra Therestrial Life on other planets.

I am also offering free coding and application development consultations with students having a problem with their Thesis projects.

View my full Curriculum Vitae here
http://ss.jaysonragasa.net/?mycv

Comments and Discussions

 
Generalif you convert to .NET 4.0 and use wshom.ocx in /.../System32 ... [modified] Pin
BillWoodruff11-Jun-11 18:41
professionalBillWoodruff11-Jun-11 18:41 
GeneralMy vote of 5 Pin
submarelime26-Jul-10 19:06
professionalsubmarelime26-Jul-10 19:06 
Generalcool tool Pin
Donsw10-Apr-09 7:45
Donsw10-Apr-09 7:45 
Thanks, its is a usefule tool.

cheers,
Donsw
My Recent Article : Organizational Structure within a Company for PMPs

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.