Link to home
Start Free TrialLog in
Avatar of cantonee
cantonee

asked on

Batch File for Deleting Icons

I am trying to write a batch file to delete an icon on users desktops.  I've used this same batch file to delete icons from the desktop in the past but this icon cannot be deleted.  I think the problem is that the shortcut's name has a hyphen and spaces in its name (i.e.  short - cut.lnk) I always know to use quotes for spaces but what do you do to get past the hyphen?

Thanks,

JK
Avatar of knightEknight
knightEknight
Flag of United States of America image

are you sure it's a hyphen?

you could try this:    "short*cut.lnk"
or, if you want to narrow it to a one-character variable:

"short ? cut.lnk"
Avatar of cantonee
cantonee

ASKER

To clarify, the shortcut is already on the user's desktops and the file name is:  short - cut.lnk   I want to delete this shortcut with a logon script batch file.  Are you saying that using the command
del "short*cut.lnk" will work?  There is a space on both sides of the hyphen in the shortcut name....Thanks for the responses.
ASKER CERTIFIED SOLUTION
Avatar of knightEknight
knightEknight
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Okay, thanks.  I ended up using:  del "the*short*cut.lnk"  and it worked.  Thanks for the quick response on a Friday!

TGIF

JK