Solved

Batch File Error Invalid Number of Parameters

Posted on 2008-06-18
4
993 Views
Last Modified: 2008-06-18
I have the following batch file which freaks out with a "Invalid number of parameters" message.
What can I do to fix it?
rd /q /s "C:\Program Files\Common Files\Microsoft Shared\Clipart\Company"

md "C:\Program Files\Common Files\Microsoft Shared\Clipart\Company"

G:

cd msoffice\New_Templates\Company

XCOPY *.* /s /e /c /y C:\Program Files\Common Files\Microsoft Shared\Clipart\Company

Open in new window

0
Comment
Question by:Priscilla_Hora
  • 2
4 Comments
 
LVL 10

Accepted Solution

by:
rynox earned 500 total points
ID: 21819357
First thing i see right off is that you need to throw some quotes around the directory in line 5 as you did in lines one and two.
0
 

Author Comment

by:Priscilla_Hora
ID: 21819438
Ahh that was right! so simple! Thanks
0
 
LVL 43

Expert Comment

by:Steve Knight
ID: 21819475
Agreed with above.  Also line 4 could be ambiguous depending upon what the current path is on the G: drive at that point.  Suggest this:

rd /q /s "C:\Program Files\Common Files\Microsoft Shared\Clipart\Company"
md "C:\Program Files\Common Files\Microsoft Shared\Clipart\Company"
XCOPY "G:\msoffice\New_Templates\Company\*.*" /s /e /c /y "C:\Program Files\Common Files\Microsoft Shared\Clipart\Company"

Steve
0
 
LVL 43

Expert Comment

by:Steve Knight
ID: 21819477
Sorry had typed earlier and hadn;t hit submit...
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Using dates in 'DOS' batch files has always been tricky as it has no built in ways of extracting date information.  There are many tricks using string manipulation to pull out parts of the %date% variable or output of the date /t command but these r…
TOMORROW TOMORROW.BAT is inspired by a question I get asked over and over again; that is, "How can I use batch file commands to obtain tomorrow's date?" The crux of this batch file revolves around the XCOPY command - a technique I discovered w…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
This is a video that shows how the OnPage alerts system integrates into ConnectWise, how a trigger is set, how a page is sent via the trigger, and how the SENT, DELIVERED, READ & REPLIED receipts get entered into the internal tab of the ConnectWise …

914 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now