Invalid number of parameters xcopy

do you know why i get this error of "Invalid number of parameters" when i use xcopy?
what is this "Invalid number of parameters?"

C:\Documents and Settings\hiro\Local Settings\Application Data\Microsoft\Outlook
>xcopy C:\Documents and Settings\hiro\Local Settings\Application Data\Microsoft\
Outlook \\server\Personal\H.Tamura\backup\Mail
Invalid number of parameters
Hiroyuki TamuraField EngineerAsked:
Who is Participating?
 
craylordCommented:
sorry i meant this was the better syntax

xcopy "%userprofile%\Local Settings\Application Data\Microsoft\Outlook\*"
"\\server\Personal\%username%\backup\Mail\" /E /H /C /D /Y

This will run independent of the user, windows will know what the %userprofile% and %username% variables mean.
0
 
briancassinCommented:
the reason you are getting an error is it is too long of a path for xcopy to understand, you will have to shorten the paths.
0
 
briancassinCommented:
sorry actually this explains it better and it is because you are using a dos based command to go to a windows based network redirector.... in short use copy command instead

http://support.microsoft.com/?kbid=192808&sd=RMVP
0
Cloud Class® Course: MCSA MCSE Windows Server 2012

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

 
craylordCommented:
You need to have quotations surrounding your source and destination paths. That's it. Copy this into your batch file.

xcopy "C:\Documents and Settings\hiro\Local Settings\Application Data\Microsoft\Outlook\*"
"\\server\Personal\H.Tamura\backup\Mail"

or this is a better syntax

xcopy "%userprofile%\Local Settings\Application Data\Microsoft\Outlook\*"
"\\server\Personal\H.Tamura\backup\Mail\" /E /H /C /D /Y
0
 
Hiroyuki TamuraField EngineerAuthor Commented:
ooh, thank you very much! i'll try that.
0
 
Leon FesterSenior Solutions ArchitectCommented:
Nope, the reason for the problem is because Xcopy hasn't been designed for Windows XP or higher. It essentially is unchange from the original Xcopy that came with Dos 5.2...I think. Basically what that means is that Xcopy cannot follow the path and read the spaces in your path, unless you enclose it in "" (double quotes).

So if you rather use:
xcopy "C:\Documents and Settings\hiro\Local Settings\Application Data\Microsoft\Outlook" \\server\Personal\H.Tamura\backup\Mail
(one 1 line of course) :)

Then it should work.

I assume that you're wanting to copy all the files in the oulook folder to the mail folder on the server?
0
 
Hiroyuki TamuraField EngineerAuthor Commented:
yes, you are right.
0
 
Hiroyuki TamuraField EngineerAuthor Commented:
are there any way i can unlock even in use of outlook?
and keep copying even after error?

C:\Documents and Settings\hiro>xcopy "C:\Documents and Settings\hiro\Local Setti
ngs\Application Data\Microsoft\Outlook" \\server\Personal\H.Tamura\backup\Mail
C:\Documents and Settings\hiro\Local Settings\Application Data\Microsoft\Outlook
\archive.pst
C:\Documents and Settings\hiro\Local Settings\Application Data\Microsoft\Outlook
\archive1.pst
File creation error - The process cannot access the file because another process
 has locked a portion of the file.
0
 
Leon FesterSenior Solutions ArchitectCommented:
Copying of a file that is open will only work if you're copying from a workstation/server that allows for Volume Shadow copying or similar. Otherwise forget about it. If a file is open, it would be in exclusive mode and it will only be released when the application that opened it is terminited.

To continue after errors use the /C switch (Just place the switch at the end after the statement, switches are seperated by spaces)

Another usefull switch is /H for hidden or system files.

Check out the full list of switches by typing xcopy /? at the command prompt.
0
 
Hiroyuki TamuraField EngineerAuthor Commented:
ooh, thank you very much. i'll try that.
0
 
craylordCommented:
No, you must close outlook or the batch file must kill the outlook.exe process before copying.
0
 
craylordCommented:
There is a program called taskkill.exe that can be used to stop outlook before copying.
This would be your batch file.


taskkill.exe /im outlook.exe
xcopy "C:\Documents and Settings\hiro\Local Settings\Application Data\Microsoft\Outlook\*"
"\\server\Personal\H.Tamura\backup\Mail"  /E /H /C /D /Y
0
 
craylordCommented:
Addind a /f will forcefully terminate the program.

taskkill.exe /im outlook.exe /f
xcopy "C:\Documents and Settings\hiro\Local Settings\Application Data\Microsoft\Outlook\*"
"\\server\Personal\H.Tamura\backup\Mail"  /E /H /C /D /Y
0
 
Hiroyuki TamuraField EngineerAuthor Commented:
I got this problem.
C:\Documents and Settings\hiro>taskkill.exe /im outlook.exe
ERROR: The process "OUTLOOK.EXE" with PID 2388 could not be terminated.
Reason: Invalid window handle.
Do you know why?
0
 
craylordCommented:
Is it the same error with this line?
taskkill.exe /im outlook.exe /f
0
 
Hiroyuki TamuraField EngineerAuthor Commented:
i got this;
C:\Documents and Settings\hiro>taskkill.exe /im outlook.exe /f
ERROR: The process "outlook.exe" not found.

C:\Documents and Settings\hiro>taskkill.exe /im outlook.exe
ERROR: The process "outlook.exe" not found.

this time, things working correctly, i guess.
0
 
craylordCommented:
Just a fluke. Does that solve your problem?
0
 
Leon FesterSenior Solutions ArchitectCommented:
That will only work if Outlook is open and running on the machine where the script runs from. If your script is being called from a server then it won't affect the client. :(
0
 
craylordCommented:
Call it a hunch, but I don't think he's trying to run this on a server client basis. It's a bigger challenge, plus he specified his own profile folder. But if he wants this done on a server client basis I have script to accomplish that. But at this point where getting into a whole new question.
0
 
Hiroyuki TamuraField EngineerAuthor Commented:
i don't run this on server.
but thank you very much.
0
 
Leon FesterSenior Solutions ArchitectCommented:
bah! sorry, I'm off from work until Tuesday and my brain is already switched off. G'luck m80, udderwise I'll post back something on Tuesday.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.