Error handle copying file from server

R

Richhall

Hi

To ensure I have the latest file for something, when i run a .cmd to
start it, I simply copy the file from a central PC when the .cmd is
run on my PC. (the application is started on a few PCs). The
problem is, it the file is unavailable or the server is unavailable
then the application won't start. What is the best way of handling
this without negatively affecting the startup time too greatly please?

example so far

@echo off
net use J: /d
net use J: \\server\share$
xcopy "J:\server\file1.txt" "C:\Myapp\" /S /Y
net use J: /d /y


Cheers

Rich
 
P

Pegasus \(MVP\)

Richhall said:
Hi

To ensure I have the latest file for something, when i run a .cmd to
start it, I simply copy the file from a central PC when the .cmd is
run on my PC. (the application is started on a few PCs). The
problem is, it the file is unavailable or the server is unavailable
then the application won't start. What is the best way of handling
this without negatively affecting the startup time too greatly please?

example so far

@echo off
net use J: /d
net use J: \\server\share$
xcopy "J:\server\file1.txt" "C:\Myapp\" /S /Y
net use J: /d /y


Cheers

Rich

You could do it like so:

@echo off
ping server -n 2 | find /i "bytes=" > nul || goto :eof
xcopy /s /y /c /d \\Server\Share$\file1.txt" "C:\Myapp\"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top