Jump to content

Error handle copying file from server


Recommended Posts

Guest Richhall
Posted

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

  • Replies 2
  • Created
  • Last Reply

Popular Days

Guest Pegasus \(MVP\)
Posted

Re: Error handle copying file from server

 

 

"Richhall" <rje.hall@yahoo.co.uk> wrote in message

news:13926e7a-9fd3-476a-9757-e665df30a161@d21g2000prf.googlegroups.com...

> 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\"

Guest Richhall
Posted

Re: Error handle copying file from server

 

thanks!!


×
×
  • Create New...