While searching for .pst files FOR keeps looping when it reaches a hidden shortcut folder
问题 The following command creates an infinite loop which is not what I want since I am iterating through files and it needs to end sometime... Here is what I have: cd C:\ FOR /R %i IN (*.pst) do @echo %i See what happens is that when it reaches AppData and finds a .pst (in AppData\Local\Microsoft\Outlook) there is a shortcut folder inside AppData\Local called "Application Data" which loops back to AppData\Local but keeps adding it's name to the address like so: %AppData%\Local\Application Data