Jump to content
Sign in to follow this  
lsakizada

Can not open file for read on win7 and 2008R2

Recommended Posts

lsakizada

Hi,

I am trying to open file for read.

It is working on Win Xp but not on Win7/2008

What am I supposed to do?

Here is my function. I am getting the error: "Error - Unable to open file:"

Func RunProcedure($filename)
    $file = FileOpen($filename, 0)
    If $file = -1 Then
        C("Error - Unable to open file: " & $filename)
        _FileWriteLog(@ScriptDir & "\Search.log", "Error - Unable to open file: " & $filename)
    Else
        $counter = 0
        While 1
            $line = FileReadLine($file)
            If @error = -1 Then ExitLoop
            Parse($filename, $line, $pString, $counter + 1)
            $counter = $counter + 1
            Sleep(5)
        WEnd
        FileClose($file)
    EndIf
EndFunc   ;==>RunProcedure

Be Green Now or Never (BGNN)!

Share this post


Link to post
Share on other sites
lsakizada

Perhaps you dont have permission to open the file.

I have administrator rights on all machines.

Same files are failing to be opened.

Any idea how to compare rights?

Edited by lsakizada

Be Green Now or Never (BGNN)!

Share this post


Link to post
Share on other sites
Richard Robertson

Are you running the script "as admin"?

Share this post


Link to post
Share on other sites
lsakizada

Are you running the script "as admin"?

Well I just noticed that I may have a lock on the file and this is not an Admin issue.

I probably need to figure out how to unlock the file..


Be Green Now or Never (BGNN)!

Share this post


Link to post
Share on other sites
Richard Robertson

If the file is locked that means another application is currently using it.

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.