Access denied, cmd move windows 7

Try:

IF EXIST "c:\mydir" (
     robocopy "%1" c:\mydir /E /IS /MOVE 
     ) ELSE (
     move /y "%1" c:\mydir 
     )

This will check if the folder exists and move contents if the folder exists and if the folder doesn't exits then it will move your folder. If you still get access denied then you probably need to get admin privileges.


At last.. here is the solution.. Thanks for help guys :)

SET mydir=C:\mydir
IF EXIST "%mydir%\%~n1\" (
  ROBOCOPY %1 "%mydir%\%~n1" /E /IS /MOVE
) ELSE (
  MOVE /Y %1 "%mydir%\"
)

If you are getting ACCESS DENIED error messages when attempting to move a folder, either

  1. You do not have correct permissions to move the folder
  2. You do not have the correct permissions to move one or more of the files in the folder
  3. One or more files are being accessed by the system/an application
  4. One or more of the files are protected from deletion.

Check for all of these possibilities.