How to delete all folder shortcuts and file shortcuts using windows command line?
13,681
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.
Related videos on Youtube
Author by
Breeze
Updated on September 18, 2022Comments
-
Breeze over 1 year
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?
-
dtbnguyen about 9 yearsYou 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.
-
Biswapriyo over 6 yearsSay the folder is C:\test. Command::
for /R "C:\test" %x in ( *.lnk ) do (del /f /q %x )
. Run it as admin.
-
-
Keith Miller about 4 yearsThe OP was asking for Command line methods.
-
Braden Dodge about 4 yearsThat'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
-
Keith Miller about 4 yearsTrue, so maybe look for problems more current than 2015 :D
-
Braden Dodge about 4 yearsJeez I guess I didn't notice it was that old
-
Keith Miller about 4 yearsLOL. I did the same thing when I started checking these forums.