Computer Hope

Microsoft => Microsoft DOS => Topic started by: w33man on October 05, 2007, 04:13:03 AM

Title: re-advertised need help Pllllleaaaaaasse
Post by: w33man on October 05, 2007, 04:13:03 AM
Hi i'm new to batch file scripting and was wondering if anyone could help me

I'm looking to run a batch file that will replace one document with another

i.e. C:\temp\master.doc  to C:\temp\minor.doc   

I want to keep the master copy but replace the minor copy with an image of the master.

Any help greatly appreciated.

Or pointers to were I can see sample scripts /code etc
Title: Re: re-advertised need help Pllllleaaaaaasse
Post by: gpl on October 05, 2007, 05:38:38 AM
This sounds very simple, so I must have misjudged your requirement .. basically, you want to replace minor.doc with a copy of master.doc

Copy /Y C:\temp\master.doc  C:\temp\minor.doc   

the /Y means to answer yes to the 'do you want to overwrite' question

Graham
Title: Re: re-advertised need help Pllllleaaaaaasse
Post by: w33man on October 05, 2007, 07:36:37 AM
Tried that graham but although i am running this batch file locally and the files for testing purposes are local the dos prompt keeps telling me the files cannot be located
Title: Re: re-advertised need help Pllllleaaaaaasse
Post by: w33man on October 05, 2007, 08:10:06 AM
Hi graham found the problem running the batch file under c:\ Documents and Settings\localuser\temp\test1\filename.txt copying to c:\ Documents and Settings\localuser\temp\test2\filename.txt

doesn't like the spaces tried under C:\tempfile\  and it ran no problem cheers for your help mate
Title: Re: re-advertised need help Pllllleaaaaaasse
Post by: Carbon Dudeoxide on October 06, 2007, 05:53:03 AM
Quote
doesn't like the spaces
If the path is C:\Documents and Settings\user\file.txt,
You have to put " on each end.

"C:\Documents and Settings\user\file.txt"