Jump to content
Sign in to follow this  

How to close opened files

Recommended Posts



I use a AutoIt script to connect on remote shares with differents users :

- The first user clicks the "Connect Shared Resources" icon an gives his login and password : DriveMapAdd starts its job and connects on network drives.

- When the user stops to work with the computer, clicks on the "Disconnect Shared Resources" icon to start DriveMapDel.

- The next user can use the computer and connects to the shared resources with his login and password

I have a probleme when a user don't close a file : the DriveMapDel do not work and le next user cannot connect.

I tried to force the deconnection using _WinNet_CancelConnection ( "r:" , True ) : the network drives disconnects, but the files are always opened, so its not possible de reconnect the drive.

My question his : how to list all handles of files or directories currently opened on an drive (R: is my network drive), and how to close all these files and directories (an external program can be included, but only a command line tool)

Thanks for your help

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this