No announcement yet.

can not Copy file to Windows system folder

  • Filter
  • Time
  • Show
Clear All
new posts

  • can not Copy file to Windows system folder

    I used file.copy to copy a file to "C:\Windows\System32\drivers" but it did not work.if I changed the path as "D:\" or any others which is not a system folder The file.copy function can work.

    File.Copy(SessionVar.Expand("%AppFolder%\\driver\\ net.sys"), SessionVar.Expand("%SystemFolder%\\drivers\\ s"), true, true, true, true, nil);

    and I changed method to copy the file.I used a bat file.if I ran the bat file directly.It worked,If I ran the bat file by setup factory it didn't work.

    I think user permission causes this the problem .So I used the function
    user_info =System.GetUserInfo() to check the permission. And user_info.IsAdmin==ture and user_info.IsVistaAdminLimitedToken==false.I think it means that the user is running with full privileges.

    So I do know why the file.copy can not work?

  • #2
    supplement about the question

    And also I get the last error after file.copy function.
    error = Application.GetLastError();
    -- If an error occurred, display the error message.
    --if (error ~= 0) then
    Dialog.Message("Error", _tblErrorMessages[error], MB_OK, MB_ICONEXCLAMATION);

    but this pump up a " Success".

    And also I try to add the copy file to my setup project and changed the destination from %AppFolder% to "C:\Windows\System32\drivers" , but failed either.


    • #3
      You may want to read this:



      • #4
        Originally posted by Ulrich View Post
        very grateful.This problem is solved.