Page 1 of 1

[Win 8.x] Robocopy and same directory

Posted: 20 Oct 2014 02:01
by balubeto
Hi

With the Robocopy command of Windows 8.x, how do I do a copy of a file (renaming it) in the same directory of the source file?

Thanks

Bye

Re: [Win 8.x] Robocopy and same directory

Posted: 20 Oct 2014 02:26
by foxidrive
This doesn't use robocopy:

Code: Select all

copy "d:\source\file.bin" "d:\source\file.new"

Re: [Win 8.x] Robocopy and same directory

Posted: 20 Oct 2014 03:13
by Yury

Code: Select all

@echo off

set "dir=D:\Test"
set "source=example.txt"
set "dest=new.txt"

pushd "%dir%"
>nul robocopy . temp "%source%"
>nul move "temp\%source%" "%dest%"
rd temp
popd

exit /b