I need to move all folders in a directory called Profile.V2 out of the directory and then I want to delete the directory. I'm using a bat file to do this which is below, this works perfectly except when a folder with the same name already exists in the location I am moving the files/folders to, this causes the bat file to stop and a prompt to appear asking if it is Ok to overwrite the folder. The move command has an argument /Y that surpress the prompt, however if I place it after "move" in my bat file it doesn't work. Can anyone spot why and where should it go?
@ECHO OFF
H:
cd Profile.V2
for /f "delims=" %%a in ('dir /b') do (
move "%%a" H:\
)
RD /S /Q H:\Profile.V2
Many thanks Steve