Jump to content

fileinstall. same file to be more than one location


Briandr
 Share

Recommended Posts

Hi,

I need to install one file to more than one location. I saw something from Jos and why the code does appear to work, when compiled it appears as if the same file is included twice base upon the EXE size. Is this correct?

FileInstall("my.scr", "C:\Windows\System32\", 1)
FileCopy("my.scr", "C:\Windows\System32\", "C:\Windows\SysWOW64\", 1)

Thanks.

Link to comment
Share on other sites

  • 2 weeks later...

Hi,

Even if this code is incorrect how can I tell how many times Autoit would have added a file to the compiled EXE ?? Right now it appears my screensaver file has been added twice. The screensaver by itself is 1.6mb and when added as part of the EXE its now about 2.6mb,

 

FileInstall("my.scr", @tempdir)

If @OSArch = "X86" Then
    FileDelete("C:\Windows\System32\my.scr")
    FileCopy(@tempdir & "C:\Windows\System32\my.scr", "C:\Windows\System32\", 1)
ElseIF @OSArch = "X64" Then
    FileDelete("C:\Windows\System32\my.scr")
    FileDelete("C:\Windows\SysWOW64\my.scr")
    FileCopy(@tempdir & "C:\Windows\System32\my.scr", "C:\Windows\System32\", 1)
    FileCopy(@tempdir & "C:\Windows\System32\my.scr", "C:\Windows\SysWOW64\", 1)
EndIf

 

Edited by Briandr
Code correction
Link to comment
Share on other sites

FileInstall("my.scr", @TempDir & "\my.scr", $FC_OVERWRITE)

If @OSArch = "X86" Then
    FileCopy(@TempDir & "C:\Windows\System32\", 9)
ElseIF @OSArch = "X64" Then
    FileCopy(@tempdir & "my.scr" & "C:\Windows\System32\", 9)
    FileCopy(@tempdir & "my.scr" & "C:\Windows\SysWOW64\", 9)
 EndIf

I put #RequireAdmin at the top of the script figuring deleting/copying to the \win\system32 and \win\syswow64 folder might be difficult. The screensaver is copying over to the temp folder, but I am having a hard time getting the existing one I need overwritten deleted. Any ideas? I have a feeling based upon what I read this is MS throwing up a road block to protect those folders. I think other scripting languages might have same issue. But is there a way to force this even if it involves deleting them first and then file copying them?

 

If someone could assist me as I have searched this forum and google for  away to copy to a protected system folder and whatever I have tried continues to fail. Thanks.

Edited by Briandr
code correction / response
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...