Discussion Locked

Closing Open Files

0 helpful
8 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
Does anyone know of a utility to close multiple open files on a Windows 2000 server?

8 replies

by xpertdragon

Are you interested in a utility that just closes open files, or do you need to perform this task for a Backup reason? If so, you might have an option that allows you to close such files on or off the server before a backup is performed.

Please provide more info.

Paul

by ears54

Thanks for the reponse Paul.
I need utility to just close the files, but I need something that will allow me to select multiple files. Windows native utilities will only allow closing a single file at a time.

Greg

by joseph moore

Well, you can run a FOR command from a Command Prompt to parse out the NET FILE command. Here is what you would do:
Open a Command Prompt on the Win2K Server that has the open files you want to close.
Type in the following:

for /f "tokens=1,2 skip=4 delims= " %i in ('net file') do net file %i /CLOSE

That will run through the whole list of open files, take out the ID number that each open file has, and then Close that file connection.
You could also save this in a BAT file and scheduleit to run whenever you want.
NOTE: remember, a FOR command in a BAT file requires that the %variables used be double %% signs. So, that line in a BAT file would read:
for /f "tokens=1,2 skip=4 delims= " %%i in ('net file') do net file %%i /CLOSE

hope this helps

This discussion is closed to new replies.