Jump to content

Multiple users of a file


Recommended Posts

When a single file is shared between 4 programs. Is it possible to "test" on that file how many is in it at the same time ?????? :D:D Its driving my brain nuts those days but if one have some ideas it would really be great.

I dont have anything with the 4 programs to do, they are working in dependent of me :)

Link to comment
Share on other sites

Hello,

I remember that you have asked a similar question.

I have already told about http://www.sysinternals.com/ntw2k/freeware/handle.shtml

If you use this program with this script, I think that it could help you (I hope)

;test if a file is used by several processes

$fic=FileOpenDialog("Chosse the file to monitor",@MyDocumentsDir,"(*.*)",3); file to monitor
if $fic=-1 then Exit
$fic='"'&$fic&'"'
Runwait(@ComSpec & " /c handle.exe "&$fic&" > "&@TempDir&"\loghandle.txt","",@SW_HIDE) 

$fic2=FileOpen(@TempDir&"\loghandle.txt",0)
$index=6; the list of processses begin at the line 6
$nameprocesses=""
while 1
    $line=FileReadLine($fic2,$index)
    if @error=-1 or $line="No matching handles found." then ExitLoop
    $tab=StringSplit($line," ")
    $nameprocesses=$nameprocesses&$tab[1]&" PID "&$tab[9]&@CRLF; for each line the first element is the name of the process and the PID is 9th 
    $index=$index+1
WEnd
MsgBox(0,$fic& "is used by :",$index-6 &" process(es)"&@CRLF&$nameprocesses)
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...