Results 1 to 4 of 4

Thread: How to copy file in Windows\system folder?

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Dec 2003
    Location
    Baton Rouge, Louisiana.
    Posts
    109

    Question How to copy file in Windows\system folder?

    Hiii,

    I need to copy few .dll and .ocx file to C:\Windows\System folder before my application loads.

    Wheni tired it gives me error

    "Permission denied".

    What could be problem? And how could you remove above problem or copy files?

    Everythin is welcome.

    Thanks in advance.

    HDave
    ~~~......Hope never dies. one has to work for it to make it reality.......~~~

  2. #2
    Frenzied Member Jmacp's Avatar
    Join Date
    Jul 2003
    Location
    UK
    Posts
    1,959
    Whats your code?

    Permission denied usually means the file is in use.

  3. #3
    Member
    Join Date
    Mar 2004
    Location
    Florida
    Posts
    44
    or the user doesn't have privleges/permissions

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Dec 2003
    Location
    Baton Rouge, Louisiana.
    Posts
    109

    Question

    Hii,

    I checked file is not in use. And I caneasily copy/pes/delete files from Windows/system folder in windows explorer. But whe i tried to do it through code, it generates error:

    Run time error"70":
    Permission denied.

    My code is,

    retval = Trim(GetWindowsDirectory(buffer, 255))

    dest = buffer & "\System"

    comdatafile = App.Path & "\" & "Components.data" 'Data file contains name of the files to be copied.

    Set tx = fsy.OpenTextFile(comdatafile, ForReading, False)

    Files = tx.ReadLine()
    While (Files <> "")

    srce = App.Path & "\" & Files
    Set file1 = fsy.GetFile(srce)
    If fsy.FileExists(srce) Then
    fsy.CopyFile srce, dest
    Else
    MsgBox "File:" & Files & "not found. Application configuration failed.", vbApplicationModal + vbExclamation + vbOKOnly, "Application Error...."
    fsy.DeleteFile (comloadfile)
    Exit Sub
    End If

    Files = tx.ReadLine()

    Wend

    tx.Close

    I do not see any problem. If anyone can tell me what is wrong?

    Thanks in advance.

    HDave
    ~~~......Hope never dies. one has to work for it to make it reality.......~~~

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width