Basically, what I want to do is...

Have a listbox with a list of directories and the executable name in, e.g.
"C:\Directory1\file.exe"
"C:\Directory2\file.exe"
"C:\Directory3\file.exe"

And then using
My.Computer.FileSystem.CopyFile(Application.ExecutablePath, [Each List Item Here], True)

To copy itself to the directories I want to :)


How can this be done?
Thanks

Recommended Answers

All 3 Replies

Please explain what you are doing and why you are doing this. This is a rather odd question

It's a custom installer for my program.
I need it to copy itself to the directories of previous versions and overwrite the files to update :)

Imports System.IO

Public Class Form1

	Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
		For Each itm As Object In ListBox1.Items
			Dim fName As String = Convert.ToString(itm)
			If (File.Exists(fName)) Then
				File.Delete(fName)
			End If
			System.IO.File.Copy(Application.ExecutablePath, fName)
		Next
	End Sub
End Class
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.