Briandr Posted January 28, 2016 Share Posted January 28, 2016 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 More sharing options...
ViciousXUSMC Posted January 28, 2016 Share Posted January 28, 2016 I do not think it should, but your FileCopy() looks wrong. Should just be source and destination and an optional 3rd parameter. You have 4 parameters. Link to comment Share on other sites More sharing options...
Briandr Posted February 12, 2016 Author Share Posted February 12, 2016 (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 February 12, 2016 by Briandr Code correction Link to comment Share on other sites More sharing options...
ViciousXUSMC Posted February 12, 2016 Share Posted February 12, 2016 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 Link to comment Share on other sites More sharing options...
Briandr Posted February 12, 2016 Author Share Posted February 12, 2016 (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 February 12, 2016 by Briandr code correction / response Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now