Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. Starting Robocopy From A Service

Starting Robocopy From A Service

Scheduled Pinned Locked Moved C#
help
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    rich_wenger
    wrote on last edited by
    #1

    Hi, and thanks for your interest. I am trying to run MS Robocopy from a service with the following code:

    Process robo = new Process();

    robo.StartInfo.FileName = "robocopy.exe";
    robo.StartInfo.Arguments = "g:\\data *.pdf d:\\data\\pdf\\ /S /NP /Log+:c:\\logs\\robo\\robo.log";
    robo.Start();

    The service starts but the Robocopy process fails to start. Any help greatly appreciated.

    C. Richard Wenger System Administrator

    M D 2 Replies Last reply
    0
    • R rich_wenger

      Hi, and thanks for your interest. I am trying to run MS Robocopy from a service with the following code:

      Process robo = new Process();

      robo.StartInfo.FileName = "robocopy.exe";
      robo.StartInfo.Arguments = "g:\\data *.pdf d:\\data\\pdf\\ /S /NP /Log+:c:\\logs\\robo\\robo.log";
      robo.Start();

      The service starts but the Robocopy process fails to start. Any help greatly appreciated.

      C. Richard Wenger System Administrator

      M Offline
      M Offline
      musefan
      wrote on last edited by
      #2

      your filename prob needs to be the full path of the executable

      R 1 Reply Last reply
      0
      • M musefan

        your filename prob needs to be the full path of the executable

        R Offline
        R Offline
        rich_wenger
        wrote on last edited by
        #3

        I dropped the Robocopy.exe in the system32 folder just to have it in the path and eliminate those issues and on your advice I included the full path to the executable but it still doesn't appear to be executing?

        C. Richard Wenger System Administrator

        M 1 Reply Last reply
        0
        • R rich_wenger

          I dropped the Robocopy.exe in the system32 folder just to have it in the path and eliminate those issues and on your advice I included the full path to the executable but it still doesn't appear to be executing?

          C. Richard Wenger System Administrator

          M Offline
          M Offline
          musefan
          wrote on last edited by
          #4

          well as your only setting 2 things (filepath, and parameters) are you sure the parameter string is valid? I.e. tested with CMD or something? I never used Robocopy so i wouldnt know the params, if both are valid then i would guess the problem is else where in your code. What functionality does Robocopy do? is it not something you can code yiurself

          1 Reply Last reply
          0
          • R rich_wenger

            Hi, and thanks for your interest. I am trying to run MS Robocopy from a service with the following code:

            Process robo = new Process();

            robo.StartInfo.FileName = "robocopy.exe";
            robo.StartInfo.Arguments = "g:\\data *.pdf d:\\data\\pdf\\ /S /NP /Log+:c:\\logs\\robo\\robo.log";
            robo.Start();

            The service starts but the Robocopy process fails to start. Any help greatly appreciated.

            C. Richard Wenger System Administrator

            D Offline
            D Offline
            Dave Kreskowiak
            wrote on last edited by
            #5

            Try running your service under a user account instead of LocalSystem and see what happens.

            A guide to posting questions on CodeProject[^]
            Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                 2006, 2007, 2008

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups