Discussion Locked

How to replace file currently in use?

0 helpful
15 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
I am referencing a central network screensaver on my workstations. I'm doing this on NT machines with a policy. On the 95 machines, I am referencing the screensaver through the system.ini. This .scr file needs to be updated frequently, but everytime you try to replace the file with the current revision, you get a "file in use error." Anyone know a way around this? I can go in through server manager and manually close the resource, but I need a regular user (not admin) to be able to replacethis file. Thanks for any help!

15 replies

by maxwell edison

The file-In-Use Replace Utility is a command-line tool that performs on-the-fly replacement of files currently in use by the operating system. You must be a member of the Administrators group to use this tool. InUse is primarily used to replace locked operating system files. After running the tool, the file specified is not replaced until the system is restarted. During restart, the system moves the file immediately after AUTOCHK is run, but before creating any paging files. This tool is usefulfor troubleshooting purposes, where you might need to replace an individual file on your computer instead of an entire set of files.

It is one of the Windows 2000/NT Server Resource Kit Support Tools, but Microsoft has made it available for freedownload.

The source for this answer and the free file download link may be found at:

http://windows.about.com/library/tips/bltip391.htm

(REMOVE SPACES from the pasted URL.)

Maxwell

by bob smithers

The trick is, I need to replace the file right then. I can't wait for a reboot for a utility to replace the file. The file resides on our file server.

by lez

From what you are saying, you may have a catch 22 situation.
All your users are accessing this file once they start up their system right? So even if one user close his/her file handle, all the other users are still locking it.

Now, only an admin ID can force everyone to close the file from the server end. And you are correct in not letting users have admin rights.

Hence the vicious loop. Theer are 2 workarounds that I can think of, use the net file command to list out the file IDs into a text file and write a batch to close all the files. An earlier thread on the net command can be found here

https://www.techrepublic.com/forumqa/thread_detail.jhtml?thread_id=94803

The other simplest solution will be to copy the scr from using autoexec, that way the file on the server won't be locked and you can update it as needed. The problem is, some people don't logout/reboot their PCs as often as administrators want them to ;p and it won't take effect until they reboot. So you'll haveto email them and tell them to reboot their PCs.

by bob smithers

Thanks for the advice, but the link above would not work for me. The other solution unfortunately probably is not the option. I think that I'll just have to close any links to that file manually. Thanks for the help though.

by lez

From what you are saying, you may have a catch 22 situation.
All your users are accessing this file once they start up their system right? So even if one user close his/her file handle, all the other users are still locking it.

Now, only an admin ID can force everyone to close the file from the server end. And you are correct in not letting users have admin rights.

Hence the vicious loop. Theer are 2 workarounds that I can think of, use the net file command to list out the file IDs into a text file and write a batch to close all the files. An earlier thread on the net command can be found here

https://www.techrepublic.com/forumqa/thread_detail.jhtml?thread_id=94803

The other simplest solution will be to copy the scr from using autoexec, that way the file on the server won't be locked and you can update it as needed. The problem is, some people don't logout/reboot their PCs as often as administrators want them to ;p and it won't take effect until they reboot. So you'll haveto email them and tell them to reboot their PCs.

by lez

Not prob.

I created a script that you can use to list the file or user you want to kick and kick them automatically. Beats having to close the files from server manager 1 at a time.

---copy the below into a cmd file, i used kick.cmd---

@echo off
if NOT "%1"=="" goto BEGIN
:SYNTAX
@echo Missing Parameter. Syntax is:
@echo Kick [Filename or Username]
goto END
:BEGIN
net file | find "%1" > c:\kick.txt
for /F "tokens=1" %%i in (c:\kick.txt) do net file /close %%i
goto END
:END

by bob smithers

Sounds like a good idea, but is there an way to run this on a remote machine. I would like to be able to kick people from the file from my workstation. Is there a way to reference the server from the script? Thanks!

by shanghai sam

Unfortunately, the net file command only works on the system it is being run on :(

You can however setup remote console software on the server.

This discussion is closed to new replies.