The process cannot access the file 'D:\pagefile.sys'

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mansi sharma
    New Member
    • Mar 2008
    • 22

    The process cannot access the file 'D:\pagefile.sys'

    I m Using the Foll. method to Read the Contents of a File. If i m reading the doc,txt prog is working file. I m using the File "D:\pagefile.sy s", ERROR is there,The process cannot access the file 'D:\pagefile.sy s' because it is being used by another process.
    how To Read Contents of "D:\pagefile.sy s".
    Need UR Help!!!!!!!!!!! !!!!!!!!!!!!!!! !!!!!!!
    Code:
        
    Imports System.io
    Module Module1
     
    Sub Main()
    Dim fs As FileStream
    fs = New FileStream("D:\Documents and Settings\Administrator\Desktop\SCAN%20HDDDDDDDDDDDDDDDD[1].doc", FileMode.Open, FileAccess.ReadWrite, FileShare.Read)
    Dim d As New StreamReader(fs)
     
    d.BaseStream.Seek(0, SeekOrigin.Begin)
     
    While d.Peek() > -1
    Console.WriteLine(d.ReadToEnd)
    Console.ReadLine()
    End While
    d.Close()
     
     
    End Sub
     
    End Module
    Last edited by DrBunchman; Jun 17 '08, 09:04 PM. Reason: Added code tags - Please use the # button
  • Curtis Rutland
    Recognized Expert Specialist
    • Apr 2008
    • 3264

    #2
    Well, for one thing you shouldn't try to use ReadWrite access to it.

    Comment

    • Plater
      Recognized Expert Expert
      • Apr 2007
      • 7872

      #3
      PageFile.sys is a system file. It is IN USE and i believe it will lock it against writing AND reading.

      I see no pivital reason for you to need access to the file?

      Comment

      • Curtis Rutland
        Recognized Expert Specialist
        • Apr 2008
        • 3264

        #4
        Originally posted by Plater
        PageFile.sys is a system file. It is IN USE and i believe it will lock it against writing AND reading.

        I see no pivital reason for you to need access to the file?
        Yeah, that's what I thought too. I didn't want to say it without trying, and I didn't want to try right now.

        But I'm pretty sure that you can't get into one of the locked system files while the OS is running, except maybe in safe mode. And even in safe mode, you shouldn't be able to get into the pagefile.

        Comment

        Working...