0

A daily windows scheduled task triggers a batch script which moves program files to a folder on a server, using a simple copy routine.

rem deploy programfiles copy dailybuild\*.dll "\\myserver\programfiles" /Y copy dailybuild\*.exe "\\myserver\programfiles" /Y 

This works just fine, unless someone is actually running the executable file, which is causing the copy to fail due to a locked file.

As this is on a terminal server, and a user may run the exe file from a shared folder (not creating a process on the terminal server), I can't find the right approach do solve this issue.

How may I release any locked files before the copy is executed? The crude solution may be to restart the terminalserver, but I hope there's another solution at hand.

Currently I am using regular batch script, and I haven't looked into powershell yet.

Anyone with a 'best practice' solution for this issue?

1 Answer 1

1

You could use a 3rd party tool to help you do this. There is a tool call "HoboCopy" that utilizes Volume Shadow Copy to make a copy of an in use file.

Here is a cool howtogeek article on how to use it.

1
  • One can also use robocopy, which should be present on any windows system. Commented Oct 22, 2013 at 11:16

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.