Batch To Delete Shortcut on Desktop

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
data808
Posts: 47
Joined: 19 Jul 2012 01:49

Batch To Delete Shortcut on Desktop

#1 Post by data808 » 31 Oct 2022 18:40

I run this batch file and it says it can't find it:

@echo off
del "%userprofile%\desktop\TEST"

pause


The shortcut is called TEST on the desktop but this batch file says it can't find it. Am I missing something?

Thanks.

ShadowThief
Expert
Posts: 1160
Joined: 06 Sep 2013 21:28
Location: Virginia, United States

Re: Batch To Delete Shortcut on Desktop

#2 Post by ShadowThief » 31 Oct 2022 19:15

If it's a shortcut, it almost certainly has the .lnk extension (that's a lowercase L, not a capital i) and you have extensions turned off so you can't see it.

data808
Posts: 47
Joined: 19 Jul 2012 01:49

Re: Batch To Delete Shortcut on Desktop

#3 Post by data808 » 01 Nov 2022 20:04

I figured there was an extension that I couldn't see and I thought it was .ink not .lnk. So I did run it both with and without .ink but it didn't work. I just tried .lnk and it worked. Thanks for clarifying that.

Also not sure if shortcut extensions are different but I am able to see all file extensions except for shortcuts which is kinda weird.

Post Reply