[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 612
  • Last Modified:

Batch file prematurely terminates

I have a batch file that runs an xcopy over the network to copy the contents of a harddrive from an older computer to a special folder on the new computer.  It's worked fine until recently it was modified to copy a few other folders over in separate xcopy commands.  Now it does the main xcopy (the first of the three at the bottom), then it stops and doesn't finish after that.

If after it fails to finish everything I need it to, I modify the file to remove everything between the set command and the last two xcopy commands, it will go through fine, so it's not that somethings typed wrong down there.

Does anyone know why it may prematurely terminate the file before finishing all of the xcopy commands?

This is being used with Windows XP.  If you need any more info, just ask :)
Echo off
 
set /p source="Enter Source Computer Service Tag: "
 
xcopy "\software\xcopy\exclude.txt" "C:\" /y /e /c /h /i
xcopy "\software\xcopy\xcopy.bat" "C:\Install" /y /e /c /h /i
 
 
mkdir "C:\old harddrive"
mkdir "C:\old harddrive\Notesbackup"
C:
cd \old harddrive
 
 
xcopy "\\%source%-company\C$\*.*" /y /e /c /h /i /exclude:C:\exclude.txt
xcopy "\\%source%-company\C$\program files\lotus\notes\*.*" "C:\old harddrive\notesbackup\program files\lotus\notes" /y /e /c /h /i
xcopy "\\%source%-company\C$\program files\wherenet\*.*" "C:\program files\wherenet" /y /e /c /h /i
 
pause

Open in new window

0
lizaoreo
Asked:
lizaoreo
  • 4
  • 3
1 Solution
 
Steve KnightIT ConsultancyCommented:
The bit mentioning xcopy.bat worries me.... if you call it that then it likely to get called instead of xcopy ... can I suggest this is called something else?

If you remove the echo off from the bbatch file can you post the output it produces please if that isn't it.

regards

Steve
0
 
Steve KnightIT ConsultancyCommented:
You haven't got an mkdir.bat or mkdir.cmd too have you?
0
 
lizaoreoAuthor Commented:
Alright, I'll try removing the xcopy.bat part, it's not really needed anymore anyways.  If that doesn't work I'll come back with the echo off results.

Nope, no mkdir.bat or mkdir.cmd files.
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
Steve KnightIT ConsultancyCommented:
Fair enough.... sorry for asking the seemingly obvious!

It depends where you run this from but if it is from c:\install or if c:\install is on your path then the second xcopy is copying that batch file into c:\install and then the next xcopy command further down would run xcopy.bat rather than xcopy.exe.

Anyway as you say give it a try and remove any xcopy.* that are lying around for starters and come back if needed.

Steve
0
 
lizaoreoAuthor Commented:
Alright, I've just started a data transfer today.  It's a long distance transfer though, so it probably won't get done until tomorrow.  Since I don't work on Fridays, it will be Monday before I can get back to you, but I will let you know what happens one way or another.  I do think you're right about the xcopy.bat thing though.  It makes sense and is kind of obvious now that you pointed it out.
0
 
lizaoreoAuthor Commented:
Thanks, looks like you were right.  After I removed the xcopy.bat file, it worked fine.

Thanks for your help Dragon
0
 
Steve KnightIT ConsultancyCommented:
No problem, glad it helped.... we've all done it and scratched heads wondering why something doesn't do what you expect...... bat and cmd always run before an exe of the same name...

Steve
0

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

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