VB.NET\robocopy UNC with spaces

  • Thread starter Thread starter Chet.Horton
  • Start date Start date
C

Chet.Horton

Guest
I am creating a tool to backup my work files to a folder on my user drive named backup. My user director looks like this:
\\server.dm1.dm2.dm3.gov\data folder

I have tried using variable and the full path directly in the command. I get the following error...
ERROR : Invalid Parameter #3 : "folder\Backup\"

I have tried the commands in the following ways...



robocopy " & source2 & " " & Dest1 & " /MIR /R:5 /W:15 /XJ /XJD /XF *.dat *.db *.zip *.ini *.inf *.pol *.log *.properties *.blf *.regtrans-ms /XD .cisco .nuget " & trace & " " & srch & " " & sg & " " & OneD & " " & edgeBack & " " & intelProf & " " & Down & " " & Contacts & " " & ThreeD & " .cisco .nuget /XA:SH /MT:30"

robocopy C:\Users\username\\server.dm1.dm2.dm3.gov\data folder\Backup /MIR /R:5 /W:15 /XJ /XJD /XF *.dat *.db *.zip *.ini *.inf *.pol *.log *.properties *.blf *.regtrans-ms /XA:SH /MT:30 /XD " & source1 & "\AppData " & music & " " & video & " " & trace & " " & srch & " " & sg & " " & OneD & " " & edgeBack & " " & intelProf & " " & Down & " " & Contacts & " " & ThreeD & " .cisco .nuget"

robocopy C:\Users\username "\\server.dm1.dm2.dm3.gov\data folder\Backup" /MIR /R:5 /W:15 /XJ /XJD /XF *.dat *.db *.zip *.ini *.inf *.pol *.log *.properties *.blf *.regtrans-ms /XA:SH /MT:30 /XD " & source1 & "\AppData " & music & " " & video & " " & trace & " " & srch & " " & sg & " " & OneD & " " & edgeBack & " " & intelProf & " " & Down & " " & Contacts & " " & ThreeD & " .cisco .nuget"

Dim Dest1 As String = ("\\server.dm1.dm2.dm3.gov\data folder\Backup\Backup\")

robocopy C:\Users\username " & Dest1 & " /MIR /R:5 /W:15 /XJ /XJD /XF *.dat *.db *.zip *.ini *.inf *.pol *.log *.properties *.blf *.regtrans-ms /XA:SH /MT:30 /XD " & source1 & "\AppData " & music & " " & video & " " & trace & " " & srch & " " & sg & " " & OneD & " " & edgeBack & " " & intelProf & " " & Down & " " & Contacts & " " & ThreeD & " .cisco .nuget"

Robocopy C:\Users\username \\server.dm1.dm2.dm3.gov\data folder\Backup /MIR /R:5 /W:15 /XJ /XJD /XF *.dat *.db *.zip *.ini *.inf *.pol *.log *.properties *.blf *.regtrans-ms /XA:SH /MT:30 /XD " & source1 & "\AppData " & music & " " & video & " " & trace & " " & srch & " " & sg & " " & OneD & " " & edgeBack & " " & intelProf & " " & Down & " " & Contacts & " " & ThreeD & " .cisco .nuget"



Dim p As New System.Diagnostics.Process
Dim stInfo As New ProcessStartInfo("cmd.exe")
stInfo.Arguments = "/k robocopy C:\Users\username \\server.dm1.dm2.dm3.gov\data folder\Backup /MIR /R:5 /W:15 /XJ /XJD /XF *.dat *.db *.zip *.ini *.inf *.pol *.log *.properties *.blf *.regtrans-ms /XA:SH /MT:30 /XD " & source1 & "\AppData " & music & " " & video & " " & trace & " " & srch & " " & sg & " " & OneD & " " & edgeBack & " " & intelProf & " " & Down & " " & Contacts & " " & ThreeD & " .cisco .nuget" stInfo.UseShellExecute = True



stInfo.UseShellExecute = True
p.StartInfo = stInfo
p.StartInfo.WindowStyle = ProcessWindowStyle.Normal
p.Start()




These don't work and get the above error on both commands using the UNC path. Everything I try except on 2 local directories with no spaces fails. Can someone help me?

Continue reading...
 
Back
Top