• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 794
  • Last Modified:

Problem getting xcopy script to run on Windows 2008 server

I have an existing xcopy script that runs on a 2003 server consistantly. I copied it to a 2008 server and edited the paths for that environment. The script executes the first copy command, but never executes the 2nd, 3rd, 4th...copy command.

Here is a sample: It only runs the 1st xopy command all the time.
xcopy F:\B2D011391.bkf x: /e/v/c/i/f/d/y >> c:\xcopy-logs\xcopy-log.txt
xcopy F:\B2D011392.bkf x: /e/v/c/i/f/d/y >> c:\xcopy-logs\xcopy-log.txt
xcopy F:\B2D011393.bkf x: /e/v/c/i/f/d/y >> c:\xcopy-logs\xcopy-log.txt
xcopy F:\B2D011394.bkf x: /e/v/c/i/f/d/y >> c:\xcopy-logs\xcopy-log.txt
0
Tony Giangreco
Asked:
Tony Giangreco
  • 4
  • 3
  • 3
  • +1
1 Solution
 
AustinComputerLabsCommented:
try using "call xcopy" for all but the last one.
0
 
Lee W, MVPTechnology and Business Process AdvisorCommented:
And there's no explanation as to why - no error message - nothing?  
0
 
Tony GiangrecoAuthor Commented:
I just tried, same result:

xcopy F:\B2D011391.bkf  x\: /e/v/c/i/f/d/y >> c:\xcopy-logs\xcopy-log.txt
xcopy F:\B2D011392.bkf  x\: /e/v/c/i/f/d/y >> c:\xcopy-logs\xcopy-log.txt
xcopy F:\B2D011393.bkf  x\: /e/v/c/i/f/d/y >> c:\xcopy-logs\xcopy-log.txt
xcopy F:\B2D011394.bkf  x\: /e/v/c/i/f/d/y >> c:\xcopy-logs\xcopy-log.txt
0
Has Powershell sent you back into the Stone Age?

If managing Active Directory using Windows Powershell® is making you feel like you stepped back in time, you are not alone.  For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why.

 
Lee W, MVPTechnology and Business Process AdvisorCommented:
Stop logging it - does it work - post a screen shot.

xcopy F:\B2D011391.bkf  x\: /e/v/c/i/f/d/y
xcopy F:\B2D011392.bkf  x\: /e/v/c/i/f/d/y
xcopy F:\B2D011393.bkf  x\: /e/v/c/i/f/d/y
xcopy F:\B2D011394.bkf  x\: /e/v/c/i/f/d/y

I always put spaces between the switches:

xcopy F:\B2D011391.bkf  x\: /e /v /c /i /f /d /y
xcopy F:\B2D011392.bkf  x\: /e /v /c /i /f /d /y
xcopy F:\B2D011393.bkf  x\: /e /v /c /i /f /d /y
xcopy F:\B2D011394.bkf  x\: /e /v /c /i /f /d /y

Finally, in this particular instance, you could use a for loop:

for /l %%a in (1,1,4) do @xcopy F:\B2D01139%%a.bkf  x\: /e /v /c /i /f /d /y
0
 
AustinComputerLabsCommented:
Have you tried:

call xcopy F:\B2D011391.bkf x: /e/v/c/i/f/d/y >> c:\xcopy-logs\xcopy-log.txt
call xcopy F:\B2D011392.bkf x: /e/v/c/i/f/d/y >> c:\xcopy-logs\xcopy-log.txt
call xcopy F:\B2D011393.bkf x: /e/v/c/i/f/d/y >> c:\xcopy-logs\xcopy-log.txt
xcopy F:\B2D011394.bkf x: /e/v/c/i/f/d/y >> c:\xcopy-logs\xcopy-log.txt
0
 
Lee W, MVPTechnology and Business Process AdvisorCommented:
Call is used for batch files... you COULD do START but the problem with that is you'd be running 4 copies at once of large files from the same location to the same location which would likely SERIOUSLY impact performance.

Copied from the CALL /? help message:
C:\Documents and Settings\leew>call /?
Calls one batch program from another.

Open in new window

0
 
Tony GiangrecoAuthor Commented:
The backups are running now. I will try in the morning.
0
 
AustinComputerLabsCommented:
@ TG-TIS You could create a seperate batch file for each copy and then create a master batch file that uses the CALL command to execute each one of the four.

@ leew I have not used CALL for a while but I swore I used it to tell the system to return to execute more commands not just more batch files, my mistake ;-)
0
 
CompProbSolvCommented:
Is there any chance you have an xcopy.cmd or xcopy.bat lying around that this is invoking?  At least in the old days, if you invoked batch file from within a batch file, it wouldn't return to the original.

@AustinComputerLabs  This may be what you are remembering... using a CALL command to another batch file and then coming back when it is done
0
 
Tony GiangrecoAuthor Commented:
This is unusual, because it almost acts as if the line breaks are not recognised so it never sees the next command.

I created the script in notepad on the 2003 server and saved it as a cmd file. I copied it to the 2008 server, edited it in notepad and saved it as a cmd. The file type looks like it's recognized because the icon associated with the file is different from a notepad text file.
0
 
CompProbSolvCommented:
Can you post both files here?  Don't copy and paste the text, upload the actual files.
0
 
Tony GiangrecoAuthor Commented:
This for/do solution worked. Thanks for your help.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

  • 4
  • 3
  • 3
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now