|
-
Feb 16th, 2000, 11:32 PM
#1
Thread Starter
Junior Member
I am trying to find out if a batch file can be created using VB. One that will autorun(optional), create a directory on the c:\ drive, copy files from the cd-rom drive to the newly created directory on the c:/.
If this is possible, can you please help me come up with the code. I have never created a batch program before.
Thanks in advance 
-
Feb 17th, 2000, 01:02 AM
#2
Thread Starter
Junior Member
Hutchie,
I don't know!! My boss just told me to research if the batch could be done in VB. What I wrote in my first request was all I got from her. She is out of the office this week and I can't ask her about it.
I would make a guess and say that the application is going to be installed on the user's machine.
Can you help either way?
Thanks Marita_l
-
Feb 17th, 2000, 01:23 AM
#3
Junior Member
Yes !,
Here is some code that you could use to create a folder on the C:\, goto the CD find the correct CD and copy the files from it to your newly created folder :.
You might need to put some error trapping in regarding not finding the CD at all though,
If you need any help let me know,
Option Explicit
Dim oFile2 As TextStream
Dim oFile As New FileSystemObject
Private Sub Form_Load()
If oFile.FolderExists("C:\Your Folder Name") Then
' Either delete or move it !
Else
oFile.CreateFolder ("C:\Your Folder Name")
GetCDfiles ' Find CD
' go to new sub to do what you need to do after the copy of the files to the H/Drive
End If
End
End Sub
Sub GetCDfiles()
Dim iCdstr
Dim oFile2 As Object
On Error Resume Next
For iCdstr = 100 To 122
Set oFile2 = oFso.GetDrive(Chr(iCdstr))
If oFile2.DriveType = 4 Then ' If this is a Cd Drive
If oFso.FileExists((oFile) & "\The CD Folder\Your file.Extension") Then ' Check one of your files exists on the cd
oFile.CopyFile (oFile) & ("\The CD Folder\The File you want to copy.extension"), ("C:\Your Folder Name\Your File.Extension"), True ' Copy the file you want to your
oFile.CopyFile (oFile) & ("\The CD Folder\The File you want to copy.extension"), ("C:\Your Folder Name\Your File.Extension"), True ' to the folder you created
oFile.CopyFile (oFile) & ("\The CD Folder\The File you want to copy.extension"), ("C:\Your Folder Name\Your File.Extension"), True
Exit Sub
End If
End If
Next
End Sub
Hutchie.
-
Feb 17th, 2000, 01:30 AM
#4
Thread Starter
Junior Member
Hutchie,
Thank you very much! This looks like it will work.
Very Appreciative 
Marita_l
-
Feb 17th, 2000, 12:14 PM
#5
Junior Member
Why don't you just get VB to create the new directory and copy the files from the CD into it ?.
If you need some code to do this let me know and I'll put something together for you.
Hutchie
-
Feb 17th, 2000, 12:20 PM
#6
Thread Starter
Junior Member
I need to incorporate it into the cd. This will be used over and over on other PC installs.
Thanks again
-
Feb 17th, 2000, 12:53 PM
#7
Junior Member
Are you going to be installing your app onto the users machine's ?.
If you are the code will be different than just running the app from the CD.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|