Announcement

Collapse
No announcement yet.

path in batch file with xcopy not works on server 2008

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • path in batch file with xcopy not works on server 2008

    Hello,
    I am trying to run a batch in scheduled task.
    By executing this batch that worked for years on 2003 server I have an error.
    Cannot figure out where to place quotes that will make it work.
    Here is my batch:

    net use t: "\\10.0.0.2\d$\EXCHANGE STORE BACKUP"
    xcopy t: "d:\exchange_db" /d/e/v/y
    net use t: /d

    Thanks.
    Michael.
    "When you hit a wrong note it's the next note that makes it good or bad". Miles Davis

  • #2
    Re: path in batch file with xcopy not works on server 2008

    Hi,

    can you manually test it line by line and let us know where it's failing with error msg.
    Thanks & Regards
    v-2nas

    MCTS 2008, MCTIP, MCSE 2003, MCSA+Messaging E2K3, MCP, E2K7
    Sr. Wintel Eng. (Investment Bank)
    Independent IT Consultant and Architect
    Blog: http://www.exchadtech.blogspot.com

    Show your appreciation for my help by giving reputation points

    Comment


    • #3
      Re: path in batch file with xcopy not works on server 2008

      try
      Code:
      @echo off & title EXCHANGE STORE BACKUP & cls
      
      echo start backup...
      echo do not close window.
      
      >"EXCHANGE STORE BACKUP.log" 2>&1 call:backup
      goto:routine1 subroutine
         :backup
         echo %date% %time% *************************************************
         pushd "\\10.0.0.2\d$\EXCHANGE STORE BACKUP" &&(
         xcopy * "d:\exchange_db\" /d /e /v /y )
         popd & exit /b 0
      :routine1 end
      
      echo Backup done
      The red colored text is basically the script you should use.
      pushd "\\10.0.0.2\d$\EXCHANGE STORE BACKUP" &&(
      xcopy * "d:\exchange_db\" /d /e /v /y )
      popd

      The rest of the code is for creating a last run log "EXCHANGE STORE BACKUP.log".
      Check the log for any errors.


      \Rems
      Last edited by Rems; 3rd February 2011, 23:20.

      This posting is provided "AS IS" with no warranties, and confers no rights.

      __________________

      ** Remember to give credit where credit's due **
      and leave Reputation Points for meaningful posts

      Comment


      • #4
        Re: path in batch file with xcopy not works on server 2008

        Rems,
        thank you for the answer...

        I was a bit in pressure when run xcopy line from CMD and did not realize that the error message was clear: "Access denied"... Then I started to play with quotes...
        And got other messages... Then I made a conclusion that 2008 needs something more...
        What happened was the guy who created new 2008 machine copied whole folder structure from old backup box. So it was permissions question. I renamed my target folder EXCHANGE STORE BACKUP to old and created new empty folder.

        My xcopy did the job.

        Thanks again.
        "When you hit a wrong note it's the next note that makes it good or bad". Miles Davis

        Comment


        • #5
          Re: path in batch file with xcopy not works on server 2008

          Ooooops (been there, done that myself ). Thanks for posting back with your discovery. Much appreciated AND you got a nice script from Rems as well. BONUS!!
          1 1 was a racehorse.
          2 2 was 1 2.
          1 1 1 1 race 1 day,
          2 2 1 1 2

          Comment

          Working...
          X