Celeb Glow
updates | March 08, 2026

Access denied, cmd move windows 7

I can't use this command in win 7 when want to move a directory if the destination exists. It says Access denied. Why hapens this? It worked in XP.

move /y "%1" c:\mydir\

I can use robocopy, but then it will move only the contents of the folder. not the folder completly.

robocopy "%1" c:\mydir /E /IS /MOVE

How can I solve this problem?

5

4 Answers

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.

1

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.

5

I'm lame and don't understand exactly what the answers here are doing under the hood so I came up with this copy/paste doozy

SET src=C:\dev
SET dest=D:\dev
IF EXIST %dest% (ROBOCOPY %src% %dest% /E /IS /MOVE) ELSE (MOVE /Y %src% %dest%)

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy