scripting help - mutable file copying

Associate
Joined
20 Jun 2007
Posts
1,641
Location
Nottingham
I need to write a script to copy 5 odd files out of a list of about 80 these 5 files are spesific to the machines we produce

the reason is so that anybody can do it without requiring to know which files are required. these files need to be copied to 2 locations. i have set it up so far to save from a USB stick onto the C drive.

this is my code so far

'//// Vareables////

const MACHINE_TYPE = ("this is where i want machine name")


'//////// Main Routine //////

If (Ask("copy all files for MACHINE_TYPE")) Then
do_copy()
Else
Msgbox "!Aborted!"
End If

Wscript.Quit()


'///////Ask//////


Function Ask(strAction)

' This function asks the user whether to perform a specific "Action"
' and sets a return code or quits script execution depending on the
' button that the user presses. This function is called at various
' points in the script below.

Dim intButton
intButton = MsgBox(strAction, _
vbQuestion + vbYesNo, _
L_Welcome_MsgBox_Title_Text )
Ask = intButton = vbYes

End Function

'//////Copy the Files/////

Function do_copy()

Const OverwriteExisting = TRUE

Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.CopyFile "\scripts\copy\start\test.txt" , "c:\target\1\", OverwriteExisting
objFSO.CopyFile "\scripts\copy\start\test.txt" , "c:\target\2\", OverwriteExisting

End Function

now in order to make it easy for me to set up the range of scripts for each machine type (i.e. one script per machine) I want the machine name easily editable (I'm trying to use a variable but it don't work). I would also like to just list the file names at I which to copy at the top, so that replace test.txt with file1,file2,file3

any help would be much appreciated
 
Back
Top Bottom