Batch File for Deleting Icons

cantonee
cantonee used Ask the Experts™
on
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
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
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"

Author

Commented:
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.
Yes, that was my suggestion ... the * will take the place of the spaces and the hyphen.  The second suggestion is like it, but the ? will match the hyphen only (not the spaces).

Author

Commented:
Okay, thanks.  I ended up using:  del "the*short*cut.lnk"  and it worked.  Thanks for the quick response on a Friday!

TGIF

JK

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial