How do I delete a shortcut with a batch file? (Win XP)

Discussion in 'Operating Systems' started by Leros, Apr 7, 2006.

  1. Leros

    Leros Lifer

    Joined:
    Jul 11, 2004
    Messages:
    21,867
    Likes Received:
    0
    I have a tea timing program that creates a shortcut for itself on the desktop when it executes. Being that I keep my desktop empty (no icons), this is really annoying. I want to create a batch file that opens the program, waits a seconds, then deletes the shorcut.

    I know how to make basic batch files, but the DEL command does not seem to work on shortcuts.

    DEL "C:\Documents and Settings\Justin\Desktop\TeaTimer"


    It says it cannot find the file (the shortcut is named TeaTimer).

    How do I delete this shorcut?
     
  2. nweaver

    nweaver Diamond Member

    Joined:
    Jan 21, 2001
    Messages:
    6,813
    Likes Received:
    0
    shortcuts have an extension (can't remember what it is, on my linux box atm). From command prompt, dir with a few swtichs (-u -s maybe??) shows the full name correctly.
     
  3. cubby1223

    cubby1223 Lifer

    Joined:
    May 24, 2004
    Messages:
    13,294
    Likes Received:
    5
    delete teatimer.lnk
     
  4. Leros

    Leros Lifer

    Joined:
    Jul 11, 2004
    Messages:
    21,867
    Likes Received:
    0
    thats exactly what i needed to know, thanks.
     
  5. MadRat

    MadRat Lifer

    Joined:
    Oct 14, 1999
    Messages:
    11,604
    Likes Received:
    0
    It will be funny if your antivirus flags this as a maliscious script.
     
  6. jfunk

    jfunk Golden Member

    Joined:
    Oct 16, 2000
    Messages:
    1,208
    Likes Received:
    0
    It would be easier to just turn off desktop icons instead of deleting them all. Plus that way if you ever want them for some reason (somebody else using your computer that isn't too savvy or you are trying to talk somebody through how to do something, etc..), you can just turn them back on.

    I'm with you though, I like no icons and a hidden task bar.



    BTW, if you didn't know the option was there, just right-click on your desktop and select: Arrange Icons By--->Show Desktop Icons

     
  7. Leros

    Leros Lifer

    Joined:
    Jul 11, 2004
    Messages:
    21,867
    Likes Received:
    0
    The problem is that I occasionally like to have icons and stuff on my desktop. I think of the desktop has a workspace rather than a place to store icons for my programs.

    Right now I have a few mp3s, a pdf and a folder of pictures on my desktop.