title: Converting Robocopy Batch To VB Script
body: <p>I'm trying to convert a BATCH file I am still working on (question at <a href="https://stackoverflow.com/questions/19519371/robocopy-mirror-destination-including-source-parent-folder">Robocopy | Mirror Destination Including Source Parent Folder</a>).</p>
  
  <p>I've made some progress, and the reason I moved to VB is to add a bit more functionality, like adding a dialog box to ask the user to browse for a folder they'd like to backup...</p>
  
  <p>Now the code I currently have (only partially converted from my original .bat file);</p>
  
  <pre><code>Dim Command1
  
  Set objShell = CreateObject("Shell.Application")
  Set objFolder = objShell.BrowseForFolder(0, "Example", 1, "c:\Programs")
  If objFolder Is Nothing Then
      Wscript.Quit
  End If
  wscript.Echo "folder: " &amp; objFolder.title &amp; " Path: " &amp; objFolder.self.path
  
  sCmd = "%windir%\System32\Robocopy.exe "
  sDate = Day(Now) &amp; "-" &amp; Month(Now) &amp; "-" &amp; Year(Now)
  sTime = Hour(Now) &amp; "-" &amp; Minute(Now) &amp; "-" &amp; Second(Now)
  sSource = objFolder &amp; " "
  sDestination = "Backups\"&amp; Year(Now) &amp;"\"&amp; Month(Now) &amp;"\"&amp; Day(Now) &amp;"\ "
  sLogDir = "Backups\Logs\"&amp; Year(Now) &amp;"\"&amp; Month(Now) &amp;"\"&amp; Day(Now) &amp;"\ "
  sSwitches = "/SEC /E /Log:"&amp; sTime &amp;".txt"
  
  Set objShell = CreateObject("Wscript.Shell")
  objShell.Run(sCmd &amp; sSource &amp; sDestination &amp; sSwitches)
  </code></pre>
  
  <p>My issue is that this is what happens according to the log file;</p>
  
  <pre><code>Source = G:\test\delete\
  Dest = G:\test\Backups\2013\10\23\
  </code></pre>
  
  <p>Meanwhile the true source is;</p>
  
  <pre><code>C:\Users\User\Desktop\delete
  </code></pre>
  
  <p>So what I'd like to try to figure out is why it is affixing "G:\test", the folder the .vbs is being run from, to its source.</p>
  
  <p>All in all, my goal is to just have Robocopy copy files, but the source is based on user input (hence the select a folder option). I would also like to add a "destination" option, that you specify where to backup to... But that is really optional, I'm sure I can figure that out if I get this first issue sorted.</p>
  
  <p>Thanks in advance for any and all assistance!</p>