robocopy returns Invalid Parameters
up vote
0
down vote
favorite
I have written a batch file, the aim of the file is to stop vm, take a back up (Copy the entire Virtualbox VMs) folder to a different drive, start VMs.
Code is as below:
@echo on
cls
echo "Change directory to Virtualbox root directory"
cd /d "c:Program FilesOracleVirtualBox"
echo "Powering off Virtual machines"
VBoxManage controlvm "centos74.master" poweroff
PING localhost -n 30 >NUL
VBoxManage controlvm "centos74.agent" poweroff
PING localhost -n 30 >NUL
echo "Commence backup work"
cd /d E:
if not exist Backup-%date:~-4,4%-%date:~-7,2%-%date:~-10,2% mkdir Backup-%date:~-4,4%-%date:~-7,2%-%date:~-10,2%
REM cd Backup-%date:~-4,4%-%date:~-7,2%-%date:~-10,2%
robocopy C:UsersuserVirtualBox VMs E:Backup-%date:~-4,4%-%date:~-7,2%-%date:~-10,2%
echo "Change directory to Virtualbox root directory"
cd /d "c:Program FilesOracleVirtualBox"
echo "Starting Virtual machines"
VBoxManage startvm "centos74.master"
PING localhost -n 30 >NUL
VBoxManage startvm "centos74.agent"
PING localhost -n 30 >NUL
@echo off
I however have two issues.
1. robocopy in itself doesn't work, please find below execution error message
-------------------------------------------------------------------------------
ROBOCOPY :: Robust File Copy for Windows
-------------------------------------------------------------------------------
Started : Tuesday, 20 November 2018 9:19:03 AM
Source - C:UsersuserVirtualBox
Dest - E:VMs
Files :
Options : /DCOPY:DA /COPY:DAT /R:1000000 /W:30
------------------------------------------------------------------------------
ERROR : Invalid Parameter #3 : "E:Backup-2018-11-20"
Simple Usage :: ROBOCOPY source destination /MIR
source :: Source Directory (drive:path or \serversharepath).
destination :: Destination Dir (drive:path or \serversharepath).
/MIR :: Mirror a complete directory tree.
For more usage information run ROBOCOPY /?
**** /MIR can DELETE files as well as copy them !
Not so important but still the below code is ineffective, meaning it should only create one and only folder even if you execute multiple times. When I execute multiple times it creates nested folder like
E:Backup-20-Nov-2018Backup-20-Nov-2018Backup-20-Nov-2018
Buggy code:
if not exist Backup-%date:~-4,4%-%date:~-7,2%-%date:~-10,2% mkdir Backup-%date:~-4,4%-%date:~-7,2%-%date:~-10,2%
Any assistance will be greatly appreciated.
batch-file
|
show 9 more comments
up vote
0
down vote
favorite
I have written a batch file, the aim of the file is to stop vm, take a back up (Copy the entire Virtualbox VMs) folder to a different drive, start VMs.
Code is as below:
@echo on
cls
echo "Change directory to Virtualbox root directory"
cd /d "c:Program FilesOracleVirtualBox"
echo "Powering off Virtual machines"
VBoxManage controlvm "centos74.master" poweroff
PING localhost -n 30 >NUL
VBoxManage controlvm "centos74.agent" poweroff
PING localhost -n 30 >NUL
echo "Commence backup work"
cd /d E:
if not exist Backup-%date:~-4,4%-%date:~-7,2%-%date:~-10,2% mkdir Backup-%date:~-4,4%-%date:~-7,2%-%date:~-10,2%
REM cd Backup-%date:~-4,4%-%date:~-7,2%-%date:~-10,2%
robocopy C:UsersuserVirtualBox VMs E:Backup-%date:~-4,4%-%date:~-7,2%-%date:~-10,2%
echo "Change directory to Virtualbox root directory"
cd /d "c:Program FilesOracleVirtualBox"
echo "Starting Virtual machines"
VBoxManage startvm "centos74.master"
PING localhost -n 30 >NUL
VBoxManage startvm "centos74.agent"
PING localhost -n 30 >NUL
@echo off
I however have two issues.
1. robocopy in itself doesn't work, please find below execution error message
-------------------------------------------------------------------------------
ROBOCOPY :: Robust File Copy for Windows
-------------------------------------------------------------------------------
Started : Tuesday, 20 November 2018 9:19:03 AM
Source - C:UsersuserVirtualBox
Dest - E:VMs
Files :
Options : /DCOPY:DA /COPY:DAT /R:1000000 /W:30
------------------------------------------------------------------------------
ERROR : Invalid Parameter #3 : "E:Backup-2018-11-20"
Simple Usage :: ROBOCOPY source destination /MIR
source :: Source Directory (drive:path or \serversharepath).
destination :: Destination Dir (drive:path or \serversharepath).
/MIR :: Mirror a complete directory tree.
For more usage information run ROBOCOPY /?
**** /MIR can DELETE files as well as copy them !
Not so important but still the below code is ineffective, meaning it should only create one and only folder even if you execute multiple times. When I execute multiple times it creates nested folder like
E:Backup-20-Nov-2018Backup-20-Nov-2018Backup-20-Nov-2018
Buggy code:
if not exist Backup-%date:~-4,4%-%date:~-7,2%-%date:~-10,2% mkdir Backup-%date:~-4,4%-%date:~-7,2%-%date:~-10,2%
Any assistance will be greatly appreciated.
batch-file
There is a space in the path `C:UsersuserVirtualBox VMs` so you have to double quote it (you should do that for all path variables possibly containing spaces)
– LotPings
Nov 20 at 0:14
if not exist "Backup-%date:~-4,4%-%date:~-7,2%-%date:~-10,2%" mkdir "Backup-%date:~-4,4%-%date:~-7,2%-%date:~-10,2%" robocopy "C:UsersuserVirtualBox VMs" "E:Backup-%date:~-4,4%-%date:~-7,2%-%date:~-10,2%"
– learner
Nov 20 at 0:42
Still not working
– learner
Nov 20 at 0:42
Got it working by xcopy, robocopy is simply rubbish!
– learner
Nov 20 at 1:44
1
Robocopy is by far superior. Unfortunate you do not understand the syntax and are unable to communicate how you are using it. Just telling us it is not working does not help anyone understand how to fix the problem.
– Squashman
Nov 20 at 2:23
|
show 9 more comments
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I have written a batch file, the aim of the file is to stop vm, take a back up (Copy the entire Virtualbox VMs) folder to a different drive, start VMs.
Code is as below:
@echo on
cls
echo "Change directory to Virtualbox root directory"
cd /d "c:Program FilesOracleVirtualBox"
echo "Powering off Virtual machines"
VBoxManage controlvm "centos74.master" poweroff
PING localhost -n 30 >NUL
VBoxManage controlvm "centos74.agent" poweroff
PING localhost -n 30 >NUL
echo "Commence backup work"
cd /d E:
if not exist Backup-%date:~-4,4%-%date:~-7,2%-%date:~-10,2% mkdir Backup-%date:~-4,4%-%date:~-7,2%-%date:~-10,2%
REM cd Backup-%date:~-4,4%-%date:~-7,2%-%date:~-10,2%
robocopy C:UsersuserVirtualBox VMs E:Backup-%date:~-4,4%-%date:~-7,2%-%date:~-10,2%
echo "Change directory to Virtualbox root directory"
cd /d "c:Program FilesOracleVirtualBox"
echo "Starting Virtual machines"
VBoxManage startvm "centos74.master"
PING localhost -n 30 >NUL
VBoxManage startvm "centos74.agent"
PING localhost -n 30 >NUL
@echo off
I however have two issues.
1. robocopy in itself doesn't work, please find below execution error message
-------------------------------------------------------------------------------
ROBOCOPY :: Robust File Copy for Windows
-------------------------------------------------------------------------------
Started : Tuesday, 20 November 2018 9:19:03 AM
Source - C:UsersuserVirtualBox
Dest - E:VMs
Files :
Options : /DCOPY:DA /COPY:DAT /R:1000000 /W:30
------------------------------------------------------------------------------
ERROR : Invalid Parameter #3 : "E:Backup-2018-11-20"
Simple Usage :: ROBOCOPY source destination /MIR
source :: Source Directory (drive:path or \serversharepath).
destination :: Destination Dir (drive:path or \serversharepath).
/MIR :: Mirror a complete directory tree.
For more usage information run ROBOCOPY /?
**** /MIR can DELETE files as well as copy them !
Not so important but still the below code is ineffective, meaning it should only create one and only folder even if you execute multiple times. When I execute multiple times it creates nested folder like
E:Backup-20-Nov-2018Backup-20-Nov-2018Backup-20-Nov-2018
Buggy code:
if not exist Backup-%date:~-4,4%-%date:~-7,2%-%date:~-10,2% mkdir Backup-%date:~-4,4%-%date:~-7,2%-%date:~-10,2%
Any assistance will be greatly appreciated.
batch-file
I have written a batch file, the aim of the file is to stop vm, take a back up (Copy the entire Virtualbox VMs) folder to a different drive, start VMs.
Code is as below:
@echo on
cls
echo "Change directory to Virtualbox root directory"
cd /d "c:Program FilesOracleVirtualBox"
echo "Powering off Virtual machines"
VBoxManage controlvm "centos74.master" poweroff
PING localhost -n 30 >NUL
VBoxManage controlvm "centos74.agent" poweroff
PING localhost -n 30 >NUL
echo "Commence backup work"
cd /d E:
if not exist Backup-%date:~-4,4%-%date:~-7,2%-%date:~-10,2% mkdir Backup-%date:~-4,4%-%date:~-7,2%-%date:~-10,2%
REM cd Backup-%date:~-4,4%-%date:~-7,2%-%date:~-10,2%
robocopy C:UsersuserVirtualBox VMs E:Backup-%date:~-4,4%-%date:~-7,2%-%date:~-10,2%
echo "Change directory to Virtualbox root directory"
cd /d "c:Program FilesOracleVirtualBox"
echo "Starting Virtual machines"
VBoxManage startvm "centos74.master"
PING localhost -n 30 >NUL
VBoxManage startvm "centos74.agent"
PING localhost -n 30 >NUL
@echo off
I however have two issues.
1. robocopy in itself doesn't work, please find below execution error message
-------------------------------------------------------------------------------
ROBOCOPY :: Robust File Copy for Windows
-------------------------------------------------------------------------------
Started : Tuesday, 20 November 2018 9:19:03 AM
Source - C:UsersuserVirtualBox
Dest - E:VMs
Files :
Options : /DCOPY:DA /COPY:DAT /R:1000000 /W:30
------------------------------------------------------------------------------
ERROR : Invalid Parameter #3 : "E:Backup-2018-11-20"
Simple Usage :: ROBOCOPY source destination /MIR
source :: Source Directory (drive:path or \serversharepath).
destination :: Destination Dir (drive:path or \serversharepath).
/MIR :: Mirror a complete directory tree.
For more usage information run ROBOCOPY /?
**** /MIR can DELETE files as well as copy them !
Not so important but still the below code is ineffective, meaning it should only create one and only folder even if you execute multiple times. When I execute multiple times it creates nested folder like
E:Backup-20-Nov-2018Backup-20-Nov-2018Backup-20-Nov-2018
Buggy code:
if not exist Backup-%date:~-4,4%-%date:~-7,2%-%date:~-10,2% mkdir Backup-%date:~-4,4%-%date:~-7,2%-%date:~-10,2%
Any assistance will be greatly appreciated.
batch-file
batch-file
asked Nov 19 at 23:58
learner
1501115
1501115
There is a space in the path `C:UsersuserVirtualBox VMs` so you have to double quote it (you should do that for all path variables possibly containing spaces)
– LotPings
Nov 20 at 0:14
if not exist "Backup-%date:~-4,4%-%date:~-7,2%-%date:~-10,2%" mkdir "Backup-%date:~-4,4%-%date:~-7,2%-%date:~-10,2%" robocopy "C:UsersuserVirtualBox VMs" "E:Backup-%date:~-4,4%-%date:~-7,2%-%date:~-10,2%"
– learner
Nov 20 at 0:42
Still not working
– learner
Nov 20 at 0:42
Got it working by xcopy, robocopy is simply rubbish!
– learner
Nov 20 at 1:44
1
Robocopy is by far superior. Unfortunate you do not understand the syntax and are unable to communicate how you are using it. Just telling us it is not working does not help anyone understand how to fix the problem.
– Squashman
Nov 20 at 2:23
|
show 9 more comments
There is a space in the path `C:UsersuserVirtualBox VMs` so you have to double quote it (you should do that for all path variables possibly containing spaces)
– LotPings
Nov 20 at 0:14
if not exist "Backup-%date:~-4,4%-%date:~-7,2%-%date:~-10,2%" mkdir "Backup-%date:~-4,4%-%date:~-7,2%-%date:~-10,2%" robocopy "C:UsersuserVirtualBox VMs" "E:Backup-%date:~-4,4%-%date:~-7,2%-%date:~-10,2%"
– learner
Nov 20 at 0:42
Still not working
– learner
Nov 20 at 0:42
Got it working by xcopy, robocopy is simply rubbish!
– learner
Nov 20 at 1:44
1
Robocopy is by far superior. Unfortunate you do not understand the syntax and are unable to communicate how you are using it. Just telling us it is not working does not help anyone understand how to fix the problem.
– Squashman
Nov 20 at 2:23
There is a space in the path `C:UsersuserVirtualBox VMs` so you have to double quote it (you should do that for all path variables possibly containing spaces)
– LotPings
Nov 20 at 0:14
There is a space in the path `C:UsersuserVirtualBox VMs` so you have to double quote it (you should do that for all path variables possibly containing spaces)
– LotPings
Nov 20 at 0:14
if not exist "Backup-%date:~-4,4%-%date:~-7,2%-%date:~-10,2%" mkdir "Backup-%date:~-4,4%-%date:~-7,2%-%date:~-10,2%" robocopy "C:UsersuserVirtualBox VMs" "E:Backup-%date:~-4,4%-%date:~-7,2%-%date:~-10,2%"
– learner
Nov 20 at 0:42
if not exist "Backup-%date:~-4,4%-%date:~-7,2%-%date:~-10,2%" mkdir "Backup-%date:~-4,4%-%date:~-7,2%-%date:~-10,2%" robocopy "C:UsersuserVirtualBox VMs" "E:Backup-%date:~-4,4%-%date:~-7,2%-%date:~-10,2%"
– learner
Nov 20 at 0:42
Still not working
– learner
Nov 20 at 0:42
Still not working
– learner
Nov 20 at 0:42
Got it working by xcopy, robocopy is simply rubbish!
– learner
Nov 20 at 1:44
Got it working by xcopy, robocopy is simply rubbish!
– learner
Nov 20 at 1:44
1
1
Robocopy is by far superior. Unfortunate you do not understand the syntax and are unable to communicate how you are using it. Just telling us it is not working does not help anyone understand how to fix the problem.
– Squashman
Nov 20 at 2:23
Robocopy is by far superior. Unfortunate you do not understand the syntax and are unable to communicate how you are using it. Just telling us it is not working does not help anyone understand how to fix the problem.
– Squashman
Nov 20 at 2:23
|
show 9 more comments
2 Answers
2
active
oldest
votes
up vote
1
down vote
accepted
Fixing some double quoting, other things and using timeout 30
instead of ping
command:
@echo on
cls
echo "Change directory to Virtualbox root directory"
cd /d "c:Program FilesOracleVirtualBox"
echo "Powering off Virtual machines"
VBoxManage controlvm "centos74.master" poweroff
timeout 30
VBoxManage controlvm "centos74.agent" poweroff
timeout 30
echo "Commence backup work"
cd /d E:
if not exist "Backup-%date:~-4,4%-%date:~-7,2%-%date:~-10,2%" mkdir "Backup-%date:~-4,4%-%date:~-7,2%-%date:~-10,2%"
REM cd "Backup-%date:~-4,4%-%date:~-7,2%-%date:~-10,2%"
robocopy "C:UsersuserVirtualBox VMs" "E:Backup-%date:~-4,4%-%date:~-7,2%-%date:~-10,2%" /r:0
echo "Change directory to Virtualbox root directory"
cd /d "c:Program FilesOracleVirtualBox"
echo "Starting Virtual machines"
VBoxManage startvm "centos74.master"
timeout 30
VBoxManage startvm "centos74.agent"
timeout 30
@echo off
Many thanks to both of you. Since Gerhard went an extra mile, I have favored his as solution but technically both are right.
– learner
Nov 20 at 14:13
add a comment |
up vote
3
down vote
Your problem is that when including quotes to protect spaces, you need to avoid ending backslashes in the folder paths because they will escape the double quotes so the arguments will not end where you think (see this question for more information).
robocopy "C:UsersuserVirtualBox VMs" "e:Backup-%date:~-4,4%-%date:~-7,2%-%date:~-10,2%" /mir
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53384345%2frobocopy-returns-invalid-parameters%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
accepted
Fixing some double quoting, other things and using timeout 30
instead of ping
command:
@echo on
cls
echo "Change directory to Virtualbox root directory"
cd /d "c:Program FilesOracleVirtualBox"
echo "Powering off Virtual machines"
VBoxManage controlvm "centos74.master" poweroff
timeout 30
VBoxManage controlvm "centos74.agent" poweroff
timeout 30
echo "Commence backup work"
cd /d E:
if not exist "Backup-%date:~-4,4%-%date:~-7,2%-%date:~-10,2%" mkdir "Backup-%date:~-4,4%-%date:~-7,2%-%date:~-10,2%"
REM cd "Backup-%date:~-4,4%-%date:~-7,2%-%date:~-10,2%"
robocopy "C:UsersuserVirtualBox VMs" "E:Backup-%date:~-4,4%-%date:~-7,2%-%date:~-10,2%" /r:0
echo "Change directory to Virtualbox root directory"
cd /d "c:Program FilesOracleVirtualBox"
echo "Starting Virtual machines"
VBoxManage startvm "centos74.master"
timeout 30
VBoxManage startvm "centos74.agent"
timeout 30
@echo off
Many thanks to both of you. Since Gerhard went an extra mile, I have favored his as solution but technically both are right.
– learner
Nov 20 at 14:13
add a comment |
up vote
1
down vote
accepted
Fixing some double quoting, other things and using timeout 30
instead of ping
command:
@echo on
cls
echo "Change directory to Virtualbox root directory"
cd /d "c:Program FilesOracleVirtualBox"
echo "Powering off Virtual machines"
VBoxManage controlvm "centos74.master" poweroff
timeout 30
VBoxManage controlvm "centos74.agent" poweroff
timeout 30
echo "Commence backup work"
cd /d E:
if not exist "Backup-%date:~-4,4%-%date:~-7,2%-%date:~-10,2%" mkdir "Backup-%date:~-4,4%-%date:~-7,2%-%date:~-10,2%"
REM cd "Backup-%date:~-4,4%-%date:~-7,2%-%date:~-10,2%"
robocopy "C:UsersuserVirtualBox VMs" "E:Backup-%date:~-4,4%-%date:~-7,2%-%date:~-10,2%" /r:0
echo "Change directory to Virtualbox root directory"
cd /d "c:Program FilesOracleVirtualBox"
echo "Starting Virtual machines"
VBoxManage startvm "centos74.master"
timeout 30
VBoxManage startvm "centos74.agent"
timeout 30
@echo off
Many thanks to both of you. Since Gerhard went an extra mile, I have favored his as solution but technically both are right.
– learner
Nov 20 at 14:13
add a comment |
up vote
1
down vote
accepted
up vote
1
down vote
accepted
Fixing some double quoting, other things and using timeout 30
instead of ping
command:
@echo on
cls
echo "Change directory to Virtualbox root directory"
cd /d "c:Program FilesOracleVirtualBox"
echo "Powering off Virtual machines"
VBoxManage controlvm "centos74.master" poweroff
timeout 30
VBoxManage controlvm "centos74.agent" poweroff
timeout 30
echo "Commence backup work"
cd /d E:
if not exist "Backup-%date:~-4,4%-%date:~-7,2%-%date:~-10,2%" mkdir "Backup-%date:~-4,4%-%date:~-7,2%-%date:~-10,2%"
REM cd "Backup-%date:~-4,4%-%date:~-7,2%-%date:~-10,2%"
robocopy "C:UsersuserVirtualBox VMs" "E:Backup-%date:~-4,4%-%date:~-7,2%-%date:~-10,2%" /r:0
echo "Change directory to Virtualbox root directory"
cd /d "c:Program FilesOracleVirtualBox"
echo "Starting Virtual machines"
VBoxManage startvm "centos74.master"
timeout 30
VBoxManage startvm "centos74.agent"
timeout 30
@echo off
Fixing some double quoting, other things and using timeout 30
instead of ping
command:
@echo on
cls
echo "Change directory to Virtualbox root directory"
cd /d "c:Program FilesOracleVirtualBox"
echo "Powering off Virtual machines"
VBoxManage controlvm "centos74.master" poweroff
timeout 30
VBoxManage controlvm "centos74.agent" poweroff
timeout 30
echo "Commence backup work"
cd /d E:
if not exist "Backup-%date:~-4,4%-%date:~-7,2%-%date:~-10,2%" mkdir "Backup-%date:~-4,4%-%date:~-7,2%-%date:~-10,2%"
REM cd "Backup-%date:~-4,4%-%date:~-7,2%-%date:~-10,2%"
robocopy "C:UsersuserVirtualBox VMs" "E:Backup-%date:~-4,4%-%date:~-7,2%-%date:~-10,2%" /r:0
echo "Change directory to Virtualbox root directory"
cd /d "c:Program FilesOracleVirtualBox"
echo "Starting Virtual machines"
VBoxManage startvm "centos74.master"
timeout 30
VBoxManage startvm "centos74.agent"
timeout 30
@echo off
edited Nov 20 at 7:34
answered Nov 20 at 7:12
Gerhard Barnard
6,90631131
6,90631131
Many thanks to both of you. Since Gerhard went an extra mile, I have favored his as solution but technically both are right.
– learner
Nov 20 at 14:13
add a comment |
Many thanks to both of you. Since Gerhard went an extra mile, I have favored his as solution but technically both are right.
– learner
Nov 20 at 14:13
Many thanks to both of you. Since Gerhard went an extra mile, I have favored his as solution but technically both are right.
– learner
Nov 20 at 14:13
Many thanks to both of you. Since Gerhard went an extra mile, I have favored his as solution but technically both are right.
– learner
Nov 20 at 14:13
add a comment |
up vote
3
down vote
Your problem is that when including quotes to protect spaces, you need to avoid ending backslashes in the folder paths because they will escape the double quotes so the arguments will not end where you think (see this question for more information).
robocopy "C:UsersuserVirtualBox VMs" "e:Backup-%date:~-4,4%-%date:~-7,2%-%date:~-10,2%" /mir
add a comment |
up vote
3
down vote
Your problem is that when including quotes to protect spaces, you need to avoid ending backslashes in the folder paths because they will escape the double quotes so the arguments will not end where you think (see this question for more information).
robocopy "C:UsersuserVirtualBox VMs" "e:Backup-%date:~-4,4%-%date:~-7,2%-%date:~-10,2%" /mir
add a comment |
up vote
3
down vote
up vote
3
down vote
Your problem is that when including quotes to protect spaces, you need to avoid ending backslashes in the folder paths because they will escape the double quotes so the arguments will not end where you think (see this question for more information).
robocopy "C:UsersuserVirtualBox VMs" "e:Backup-%date:~-4,4%-%date:~-7,2%-%date:~-10,2%" /mir
Your problem is that when including quotes to protect spaces, you need to avoid ending backslashes in the folder paths because they will escape the double quotes so the arguments will not end where you think (see this question for more information).
robocopy "C:UsersuserVirtualBox VMs" "e:Backup-%date:~-4,4%-%date:~-7,2%-%date:~-10,2%" /mir
answered Nov 20 at 7:21
MC ND
58.2k54777
58.2k54777
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53384345%2frobocopy-returns-invalid-parameters%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
There is a space in the path `C:UsersuserVirtualBox VMs` so you have to double quote it (you should do that for all path variables possibly containing spaces)
– LotPings
Nov 20 at 0:14
if not exist "Backup-%date:~-4,4%-%date:~-7,2%-%date:~-10,2%" mkdir "Backup-%date:~-4,4%-%date:~-7,2%-%date:~-10,2%" robocopy "C:UsersuserVirtualBox VMs" "E:Backup-%date:~-4,4%-%date:~-7,2%-%date:~-10,2%"
– learner
Nov 20 at 0:42
Still not working
– learner
Nov 20 at 0:42
Got it working by xcopy, robocopy is simply rubbish!
– learner
Nov 20 at 1:44
1
Robocopy is by far superior. Unfortunate you do not understand the syntax and are unable to communicate how you are using it. Just telling us it is not working does not help anyone understand how to fix the problem.
– Squashman
Nov 20 at 2:23