Ras
Ras

Reputation: 547

Invalid arguments in Command

Thanks for looking into my question.

I have a batch command to copy the files to remote server and if I run this command from command prompt it ran well.

echo D|xcopy /E /Y ..\Media \\%Win_Machine%\C$\temp\%APP_VERSION%\Media

Whereas if I run the same command through batch file, it says "Invalid number of parameters".

Please help me if I am missing anything here.

Thanks.

Upvotes: 0

Views: 1586

Answers (2)

Ras
Ras

Reputation: 547

It was resolved. Forgot to post the answer. I see extra spaces being posted %APP_VERSION%. It is working fine now. anyway, Thanks Magoo for valuable inputs.

Upvotes: 0

Magoo
Magoo

Reputation: 79982

echo D|xcopy /E /Y ..\Media "\\%Win_Machine%\C$\temp\%APP_VERSION%\Media"

Invalid number of parameters would indicate that xcopy sees three or more parameters. Since the first two arguments are switches, then it would seem that the final argument is being interpreted as two or more parameters - which would mean that the values of the user-variables would contain separators. Quoting the arguments tells cmd to interpret the string between the quotes as a single entity.

Upvotes: 1

Related Questions