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.
Example: xyz.exe is currently being used in javaw.exe
Your help would be greatly appreciated.
0 Comments
[ + ] Show comments
Answers (1)
Please log in to answer
Posted by:
anonymous_9363
14 years ago
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... :(
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.
so that the conversation will remain readable.