title: Copy files in VB.NET
body: <p>I'm trying to create an installer-like application. Here is what its supposed to do: create a directory in C: and name it batch. Then copy the files from the folder and move it to the C:\batch directory. But the copying of files doesn't work.</p>
  
  <p>How am I supposed to put the exact directory in here if that exact directory does not apply to all? What do I do with it? If the file that is to be copied is from: <code>E:\Documents and Settings\Rew\My Documents\Visual Studio 2008\Projects\batch\batch</code></p>
  
  <p>I want it to be universal. So that wherever the file maybe it could always copy it regardless of where it is located.</p>
  
  <p>Somehow the creating of a directory work.</p>
  
  <pre><code>Dim FileToCopy As String
  Dim NewCopy As String
  Try
      Directory.CreateDirectory("C:\Batch")
  
      FileToCopy = "\batch\batch\ipconfigrenew.bat"
      FileToCopy = "\batch\batch\ipconfigrelease.bat"
      FileToCopy = "\batch\batch\ipconfigflushdns.bat"
      NewCopy = "C:\Batch"
  
      If System.IO.File.Exists(FileToCopy) = True Then
          System.IO.File.Copy(FileToCopy, NewCopy)
          MsgBox("File Copied")
      End If
  Catch
  End Try
  MsgBox("Done")
  </code></pre>