0

I have a folder that contains lots of files and some folder/file shortcuts. I want to deletes these shortcuts (recursively) but I don't know how coz shortcuts don't have file extension (not sure true or not). May I know what command I can use to achieve this?

I suppose the windows command should be like this:

delete /S *.fileshortcut

By the way, is there difference between a file shortcut and folder shortcut?

3
  • 2
    I think shortcuts in Windows have a .lnk extension
    – jcbermu
    Commented Mar 24, 2015 at 15:18
  • You don't need the command line to do this if that's what you're thinking. Open up Windows Explorer. Type in 'type:shortcut' in the search filter box. Select all and delete. No difference between file and folder shortcut as you'll soon see.
    – dtbnguyen
    Commented Mar 24, 2015 at 15:46
  • Say the folder is C:\test. Command:: for /R "C:\test" %x in ( *.lnk ) do (del /f /q %x ). Run it as admin.
    – Biswapriyo
    Commented Sep 10, 2017 at 4:52

2 Answers 2

1

If you do not want to delete the contents of a folder shortcut, right click it, go to properties and delete the target. That should leave you with a new shortcut that goes to my computer. Then you can safely delete that new one as its not pointing to any contents.

0

Since Windows uses the .lnk extension for shortcuts (or "soft links" depending on the lingo) the easiest way to do what your looking to do is from within File Explorer.

1.Navigate to the folder where you want to get rid of all the shortcuts.

2.In the search bar in the upper right type in "*.lnk". This will search for all .lnk files within the current folder and all subfolders and display the results.

3.Just delete all the search results.

And no, in this case, there will be no difference between a lnk pointing to a file and one pointing to a folder, other than that the shortcut icons will look different.

5
  • The OP was asking for Command line methods. Commented Feb 27, 2020 at 23:46
  • That's true, but that doesn't make this method any less useful, especially if the op decides this method is more effective. Let's not forget the purpose of Q&A, to solve a problem Commented Feb 27, 2020 at 23:48
  • True, so maybe look for problems more current than 2015 :D Commented Feb 27, 2020 at 23:51
  • Jeez I guess I didn't notice it was that old Commented Feb 27, 2020 at 23:53
  • LOL. I did the same thing when I started checking these forums. Commented Feb 27, 2020 at 23:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .