[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 7326
  • Last Modified:

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
0
Hiroyuki Tamura
Asked:
Hiroyuki Tamura
  • 8
  • 7
  • 4
  • +1
1 Solution
 
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
 
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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
 
Hiroyuki TamuraAuthor Commented:
ooh, thank you very much! i'll try that.
0
 
Leon FesterCommented:
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 TamuraAuthor Commented:
yes, you are right.
0
 
Hiroyuki TamuraAuthor 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 FesterCommented:
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 TamuraAuthor 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 TamuraAuthor 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 TamuraAuthor 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 FesterCommented:
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 TamuraAuthor Commented:
i don't run this on server.
but thank you very much.
0
 
Leon FesterCommented:
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

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 8
  • 7
  • 4
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now