Link to home
Start Free TrialLog in
Avatar of RayT
RayTFlag for United States of America

asked on

Running RoboCopy from Visual Basic Application

I need help with the following code.  Both SourceFile and TargetFile contains spaces.  How do I make this work?  Currently it does nothing.

    Dim RoboCopyArgs As New StringBuilder

    With RoboCopyArgs
                        .Clear()
                        .Append("""")
                        .Append(SourceFile)
                        .Append("""")
                        .Append(" ")
                        .Append("""")
                        .Append(TargetFile)
                        .Append("""")
                        .Append(" /S /E ")
                    End With

                    Dim proc As Process = Process.Start("C:\Windows\SysWOW64\Robocopy.exe", RoboCopyArgs.ToString)

                    proc.Start()

                    proc.Close()
Avatar of Alex
Alex
Flag of United Kingdom of Great Britain and Northern Ireland image

because you're not telling it to do anything,

You need to use a /MIR /Copy or a /Copyall switch.

I think a /dcopy can be used too
ASKER CERTIFIED SOLUTION
Avatar of Alex
Alex
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of RayT

ASKER

Thanks!  I've got to start reading these manuals :)
anytime buddy

have a good day