I would like to make a.bat file which will make a backup for my kdbx file. I have two simple commands there.
cd C://Access
xcopy access4.kdbx access4.backup.kdbx /Y
but the second one ask me: Does access4.backup.kdbx specify a file name or directory name on the target (F = file, D = directory)?
I dont understand why Windows does not recognize the file in the source. Also I don't see any option to set it up in the command. How can I solve it?
You are mixing simple and multiple copying of files:
xcopy
is to be used for copying multiple files.
copy
is to be used for copying just one file.
So, your command should be:
copy /Y access4.kdbx access4.backup.kdbx
To begin with, the Windows path separator is \
but not /
or //
.
Then you should use cd /D
rather than plain cd
since you specified also a drive letter.
The quick solution is to use copy
rather than xcopy
, because it does not show such a prompt:
cd /D "C:\Access"
copy /Y "access4.kdbx" "access4.backup.kdbx"
However, xcopy
features a lot of additional options in contrast to copy
, so the latter might not help in certain situations.
To avoid the prompt, you could pre-create the destination file and let xcopy
overwrite it:
cd /D "C:\Access"
>> "access4.backup.kdbx" rem/
xcopy /Y "access4.kdbx" "access4.backup.kdbx"
See also this answer .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.