Remortgages | New York Hotels | Web Advertising | Online MBA Degree | Mortgage Calculator
Batch File Coding Question [Archive] - PCMech Forums

PDA

View Full Version : Batch File Coding Question


Felix
09-17-2000, 02:08 AM
Hi folks,

I'm back for a little wile. Baby daughter is growing up, Family is consuming almost all of my time... But it's definately worth it! :)

So here's my question:

I want to code a DOS batch file which xcopies the setup files from the windows cd to the hard drive. Since the source drive (cd rom drive) and the target drive vary in each case I want to get this data from user input.

In Basic I would do it something like this:

input SourceDrive
input TargetDrive
SourcePath=SourceDrive+"\Win95\*.*"
TargetPath=TargetDrive+"\Setup\Win95\"
xcopy SourcePath TargetPath /s /e


How do you this in a DOS batch file? Any help is highly appreciated. Thank you all!

mosquito
09-18-2000, 03:19 AM
You can use parameters with the batch file.

If your batch file is named CopyWin.bat, the commandline can be Copywin d: c:

and the source of the batch file can be:

SourcePath=%1+"\Win95\*.*"
TargetPath=%2+"\Setup\Win95\"
xcopy SourcePath TargetPath /s /e


that's it...

Felix
09-18-2000, 03:18 PM
Cool! That's what I was looking for...
Thanks mosquito!