Copy in FOR loop works but keeps giving the error “The file cannot be copied onto itself”
问题 So when I copy using the dirs %userprofile%\Desktop\Out and %userprofile%\Desktop\Out\test The .txt are copied over however I get the error The file cannot be copied onto itself. When I run the script with %userprofile%\Desktop\Out and %userprofile%\Desktop\New Folder It runs smoothly. So my question is why does the script get confused when you copy from a common root folder to a different sub folder? @ECHO ON FOR /r "%userprofile%\Desktop\Out" %%a IN (*.txt) DO copy "%%a" "%userprofile%