msvisual.com Forum Index
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

errors creating .bat with exclude

 
Post new topic   Reply to topic    msvisual.com Forum Index -> VB DOS
Author Message
bewald



Joined: 04 Oct 2007
Posts: 1

PostPosted: Thu Jul 12, 2007 12:12 pm    Post subject: errors creating .bat with exclude Reply with quote

Good day,
I am having an issue creating a backup.bat file that has an exclude
statement. What I am trying to do is to backup the My Documents folder
off of C: while excluding the Music directory (to save space). The
backed up files are copied to the mapped H: drive. If anyone can see
where I have gone wrong please let me know. Thank you!!!

Echo
SET ExclPath="C:\Documents and Settings\%username%\My
Documents\Exclude\exclude.txt"
XCOPY "C:\My Documents" /e /s /y H:/EXCLUDE: "C:\Documents and
Settings\%username%\My Documents\Exclude\exclude.txt"

Errors =
Invalid number of parameters

Archived from group: microsoft>public>vb>dos
Back to top
View user's profile Send private message
The Peasant



Joined: 04 Oct 2007
Posts: 31

PostPosted: Sat Jul 21, 2007 12:52 am    Post subject: Re: errors creating .bat with exclude Reply with quote

I think that your parameters are in the wrong order and maybe
over-complicated
DOS never liked inverted commas either.
/s is redundant in your command.

Try:-

Echo
XCOPY C:\My Documents H: /e /y /EXCLUDE:Music

More info at www.computerhope.com/xcopyhlp.htm
The Peasant



"bewald" wrote in message @microsoft.com...
> Good day,
> I am having an issue creating a backup.bat file that has an exclude
> statement. What I am trying to do is to backup the My Documents folder
> off of C: while excluding the Music directory (to save space). The
> backed up files are copied to the mapped H: drive. If anyone can see
> where I have gone wrong please let me know. Thank you!!!
>
> Echo
> SET ExclPath="C:\Documents and Settings\%username%\My
> Documents\Exclude\exclude.txt"
> XCOPY "C:\My Documents" /e /s /y H:/EXCLUDE: "C:\Documents and
> Settings\%username%\My Documents\Exclude\exclude.txt"
>
> Errors =
> Invalid number of parameters
>
Back to top
View user's profile Send private message
Stefano Gatto



Joined: 04 Oct 2007
Posts: 1

PostPosted: Sun Aug 26, 2007 8:56 am    Post subject: RE: errors creating .bat with exclude Reply with quote

Hello,

I think your syntax was alright, the only point was the space between
/EXCLUDE: and the filename. DOS uses spaces to delimit arguments and in this
case found more than 2 pure filenames parameters, so it said that there were
too many parameters without specifying of which type.

/e and /s are indeed redundant, but would never generate (such) an error.

What I learned myself is that the order of the destination argument and the
switch arguments /x doesn't matter, i.e.

xcopy source dest /s /v
xcopy source /s /v dest
xcopy source /s dest /v

all work the same.
--
Stefano Gatto


"bewald" wrote:

> Good day,
> I am having an issue creating a backup.bat file that has an exclude
> statement. What I am trying to do is to backup the My Documents folder
> off of C: while excluding the Music directory (to save space). The
> backed up files are copied to the mapped H: drive. If anyone can see
> where I have gone wrong please let me know. Thank you!!!
>
> Echo
> SET ExclPath="C:\Documents and Settings\%username%\My
> Documents\Exclude\exclude.txt"
> XCOPY "C:\My Documents" /e /s /y H:/EXCLUDE: "C:\Documents and
> Settings\%username%\My Documents\Exclude\exclude.txt"
>
> Errors =
> Invalid number of parameters
>

Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    msvisual.com Forum Index -> VB DOS All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group