General discussion

Locked

Closing a Resource

By lbabson ·
Does anyone know how to close a resource from the command line? I need a command line way to mimic the action of going into Server Manager, choosing an open file, and clicking the Close Resource button.

This conversation is currently closed to new comments.

6 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

Closing a Resource

by McKayTech In reply to Closing a Resource

If you know the file ID, you can use "net file [id] /close". I haven't figured out yet how you get a list of the open file IDs so I know this isn't the whole answer but maybe it will give you a starting point.

paul

Collapse -

Closing a Resource

by lbabson In reply to Closing a Resource

Thanks. This did give me a start. I have to send the output of the net file command to a file. Use grep to search the file for the files I'm concerned about, extract the file ids, then use net file id /close. -A pain, but so far it's the only way.
Thanks again.

Collapse -

Closing a Resource

by _Degan_ In reply to Closing a Resource

I'll be interested if someone has a direct answer to this question.

If you need to do this repeatedly, and the resource is an application, you can use the resource kit an make the application run as a service. Then you can easily use an NET START and STOP to control it.

Collapse -

Closing a Resource

by lbabson In reply to Closing a Resource

Thanks for trying, but no, they are database files that remain open even if the application that uses them is closed. See my comment back to Paul if you're interested in the flips I have to go through to make this work.

Collapse -

Closing a Resource

by wayne.maples In reply to Closing a Resource

The Windows NT Resource Kit includes Tlist.exe and PUList.exe which lists active tasks and processes and gives the pid . Combined with the kill command, you could do this.

-Wayne

Collapse -

Closing a Resource

by lbabson In reply to Closing a Resource

Thanks for trying, but I need to close files, not processes. These are great tools though. See my comments to Paul to see how I finally got this to work.

Back to Windows Forum
6 total posts (Page 1 of 1)  

Operating Systems Forums