• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 398
  • Last Modified:

Delete shortcut off of the desktop

I have a few shortcuts on my desktop that are put there by my login script.  The shortcuts bug me, but I don't want to bother IT to remove this from the login script.

Please provide C# code that will allow me to remove the shortcuts to the Recycle Bin and then empty the Recycle Bin.
0
Tom Knowlton
Asked:
Tom Knowlton
  • 3
  • 2
1 Solution
 
GrnEggsAndHamCommented:
using System.IO;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            File.Delete("filepath.ext");
            File.Delete("filepath.ext");
            // etc..


        }
    }
}
0
 
Tom KnowltonWeb developerAuthor Commented:
GrnEggsAndHam:

Now I feel really really REALLY dumb....  :)

It really is that easy.


Now....this works fine for ONE of the links.......but what is weird is that the OTHER link....is on my Desktop.....but does not show up in my directory listing of the Desktop (from command.com)

What would cause a link not to show up?
0
 
GrnEggsAndHamCommented:
are you sure you're looking at the right desktop/profile?  what windows version are you using?
0
 
Tom KnowltonWeb developerAuthor Commented:
GrnEggs:

It was another Desktop!!!!


I have (it seems) two Desktops that are MERGING...one on my Y:  drive   and one on my  C:  drive.....


It's working now, here's the code:

using System;
using System.IO;

namespace DeleteNovatekShortcuts
{
      class Class1
      {
            [STAThread]
            static void Main(string[] args)
            {                  
                  File.Delete("Y:\\Desktop\\mcmast~1.url");
                  File.Delete("C:\\docume~1\\alluse~1\\desktop\\allian~1.lnk");                  
            }
      }
}


0
 
Tom KnowltonWeb developerAuthor Commented:
Windows XP Pro is my OS.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now