Jump to content

Recommended Posts

Posted

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.

  • 2 weeks later...
Posted (edited)

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
Posted

Does not sound too far off, it if was in there 2x it would be 3.2MB+ you have your 1.6mb file and of course all the code/includes from compiling the script that is usually about 900KB for me rounding up to 1MB 1.6MB + 1MB = 2.6MB

Posted (edited)
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

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...