/build/static/layout/Breadcrumb_cap_w.png

VBScript to know file is in use or not

I am looking for a vbscript that tells me whether a file is being used by some process or not.

Example: xyz.exe is currently being used in javaw.exe

Your help would be greatly appreciated.

0 Comments   [ + ] Show comments

Answers (1)

Posted by: anonymous_9363 14 years ago
Red Belt
0
Tried Google? I found this in 0.22 seconds.

I just thought of another thing to try. Turn off error-checking (On Error Resume Next) and attempt to open it. If you get error 55 (I think it's 55...), the file is open by some other process.

I don't think there's a native way in VBScript to determine what process has the file open. For that, I think you'd need to get into retrieving file handles and then using a Windows API to match that against process IDs. Again, there's no native access to Windows APIs so you'd need something like DynaWrap... :(
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ