Batch : Renaming a folder in 'program files'
I need to write a batch to rename a folder in Program Files
.
I'm able to开发者_StackOverflow do it through the Explorer, so I guess I have all required rights.
But when I write something like this in a command line :
move "C:\Program Files\Ceebot4\train" train_old
I get the following error : Access denied.
Is it possible to do it ?
A batch file runs in MS-Dos mode and so is subject to different access rights to Windows Explorer. Try running your batch file or Dos prompt as an administrator should work
You are trying to move the contents to a directory named train_old
right under the directory where you currently are when executing the command. If you want to rename the directory in current place you will have to use:
move "C:\Program Files\Ceebot4\train" "C:\Program Files\Ceebot4\train_old"
move
moves things, so either do what Anders said (giving the full path in both places; but be careful the target name doesn't already exist), or use ren
instead:
ren "C:\Program Files\Ceebot4\train" train_old
精彩评论