• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 411
  • 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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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