How to delete all folder shortcuts and file shortcuts using windows command line?

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 Answers

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.

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

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like