Atakanbasturk Posted June 8, 2014 Share Posted June 8, 2014 (edited) FileCopy(@ScriptDir & "\a.exe" , @ProgramFilesDir & "\a\", $FC_OVERWRITE) I'm using 64 bit Windows 7. I want to copy a.exe to "C:Program Filesa". Not "C:Program Files (x86)a". But "@ProgramFilesDir" send a.exe to "C:Program Files (x86)a". I read '?do=embed' frameborder='0' data-embedContent>> but I can't do it. I try all codes. No matter what I did, it copied to "Program Files (x86)...". I want to copy it "Program Files..." in 64 bit Windows, not x86 path. And I want to add onething. My script will be able to run at both windows(x86-x64) and copy a.exe to "Program Files" path not Program Files (x86) path... Edited June 8, 2014 by Atakanbasturk Link to comment Share on other sites More sharing options...
Iczer Posted June 8, 2014 Share Posted June 8, 2014 try : FileCopy(@ScriptDir & "\a.exe" , StringRegExpReplace(@ProgramFilesDir & "\a\"," \(x86\)",""), $FC_OVERWRITE) Link to comment Share on other sites More sharing options...
Atakanbasturk Posted June 8, 2014 Author Share Posted June 8, 2014 (edited) try : FileCopy(@ScriptDir & "\a.exe" , StringRegExpReplace(@ProgramFilesDir & "\a\"," \(x86\)",""), $FC_OVERWRITE) thank you very much it works. I want to ask onething: When I write #RequireAdmin to my codes' top line, do all my codes working with "run as administrator"? For example: expandcollapse popup#RequireAdmin Case $idRAR If @OSArch="X86" Then ProgressOn("32 bit WinRAR", "İndiriliyor...", "0%") $url = "http://www.rarlab.com/rar/wrar501tr.exe" $folder = @DesktopDir & "\winrartürkçe.exe" $hInet = InetGet($url, $folder, 1, 1) $FileSize = InetGetSize($url) While Not InetGetInfo($hInet, 2) Sleep(500) $BytesReceived = InetGetInfo($hInet, 0) $Pct = Int($BytesReceived / $FileSize * 100) ProgressSet($Pct, $Pct & "%") WEnd ProgressOff() Run("winrartürkçe.exe /S") ProcessWaitClose("winrartürkçe.exe") FileDelete(@DesktopDir & "\winrartürkçe.exe") Sleep(1000) ProcessClose("WinRAR.exe") FileCopy(@ScriptDir & "\rarreg.key" , @ProgramFilesDir & "\WinRAR\", $FC_OVERWRITE) TrayTip("WİNRAR Türkçe 32 bit", "Winrar kurulumu tamamlanmıştır!", 10) Sleep(3000) ElseIf @OSArch="X64" Then ProgressOn("64 bit WinRAR", "İndiriliyor...", "0%") $url = "http://www.rarlab.com/rar/winrar-x64-501tr.exe" $folder = @DesktopDir & "\winrartürkçe64.exe" $hInet = InetGet($url, $folder, 1, 1) $FileSize = InetGetSize($url) While Not InetGetInfo($hInet, 2) Sleep(500) $BytesReceived = InetGetInfo($hInet, 0) $Pct = Int($BytesReceived / $FileSize * 100) ProgressSet($Pct, $Pct & "%") WEnd ProgressOff() Run("winrartürkçe64.exe /S") ProcessWaitClose("winrartürkçe64.exe") Sleep(1000) ProcessClose("WinRAR.exe") FileDelete(@DesktopDir & "\winrartürkçe64.exe") FileCopy(@ScriptDir & "\rarreg.key" , StringRegExpReplace(@ProgramFilesDir & "\WinRAR\"," \(x86\)",""), $FC_OVERWRITE) TrayTip("WİNRAR Türkçe 64 bit", "Winrar kurulumu tamamlanmıştır!", 10) Sleep(3000) EndIf Or expandcollapse popup#RequireAdmin ase $idRAR If @OSArch="X86" Then ProgressOn("32 bit WinRAR", "İndiriliyor...", "0%") #RequireAdmin $url = "http://www.rarlab.com/rar/wrar501tr.exe" $folder = @DesktopDir & "\winrartürkçe.exe" $hInet = InetGet($url, $folder, 1, 1) $FileSize = InetGetSize($url) While Not InetGetInfo($hInet, 2) Sleep(500) $BytesReceived = InetGetInfo($hInet, 0) $Pct = Int($BytesReceived / $FileSize * 100) ProgressSet($Pct, $Pct & "%") WEnd ProgressOff() Run("winrartürkçe.exe /S") ProcessWaitClose("winrartürkçe.exe") FileDelete(@DesktopDir & "\winrartürkçe.exe") Sleep(1000) ProcessClose("WinRAR.exe") #RequireAdmin FileCopy(@ScriptDir & "\rarreg.key" , @ProgramFilesDir & "\WinRAR\", $FC_OVERWRITE) TrayTip("WİNRAR Türkçe 32 bit", "Winrar kurulumu tamamlanmıştır!", 10) Sleep(3000) ElseIf @OSArch="X64" Then ProgressOn("64 bit WinRAR", "İndiriliyor...", "0%") #RequireAdmin $url = "http://www.rarlab.com/rar/winrar-x64-501tr.exe" $folder = @DesktopDir & "\winrartürkçe64.exe" $hInet = InetGet($url, $folder, 1, 1) $FileSize = InetGetSize($url) While Not InetGetInfo($hInet, 2) Sleep(500) $BytesReceived = InetGetInfo($hInet, 0) $Pct = Int($BytesReceived / $FileSize * 100) ProgressSet($Pct, $Pct & "%") WEnd ProgressOff() Run("winrartürkçe64.exe /S") ProcessWaitClose("winrartürkçe64.exe") Sleep(1000) ProcessClose("WinRAR.exe") #RequireAdmin FileDelete(@DesktopDir & "\winrartürkçe64.exe") FileCopy(@ScriptDir & "\rarreg.key" , StringRegExpReplace(@ProgramFilesDir & "\WinRAR\"," \(x86\)",""), $FC_OVERWRITE) TrayTip("WİNRAR Türkçe 64 bit", "Winrar kurulumu tamamlanmıştır!", 10) Sleep(3000) EndIf I mean one "#RequireAdmin" to top line is enough for whole codes and works or, should I write "#RequireAdmin" for each different work(copy, delete,run works)??? You know except Professional and Ultimate, Windows request administrator rigths for many things and can block some autoit works. Edited June 8, 2014 by Atakanbasturk Link to comment Share on other sites More sharing options...
iamtheky Posted June 8, 2014 Share Posted June 8, 2014 Once is fine, you are just prompting for UAC. Once elevated, your script (and most processes that you call from your script) will then run elevated as well. ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__) Link to comment Share on other sites More sharing options...
jguinch Posted June 8, 2014 Share Posted June 8, 2014 For the ProgramFiles location, you can also get it in the registry (I think it's a sure way) $programFilesDir = RegRead("HKLM64\SOFTWARE\Microsoft\Windows\CurrentVersion", "ProgramFilesDir") MsgBox(0, "", $programFilesDir) Spoiler Network configuration UDF, _DirGetSizeByExtension, _UninstallList Firefox ConfigurationArray multi-dimensions, Printer Management UDF Link to comment Share on other sites More sharing options...
Atakanbasturk Posted June 8, 2014 Author Share Posted June 8, 2014 Thanks both of you. Link to comment Share on other sites More sharing options...
UEZ Posted June 8, 2014 Share Posted June 8, 2014 Atakan, just for your information. @ProgramFilesDir macro depends also how you start your compiled script. If it is compiled as x64 @ProgramFilesDir is C:Program Files, as x86 is C:Program Files (x86). The 64-bit version can only be installed when the os architecture supports x64 execution. Br, UEZ Atakanbasturk and meoit 2 Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
rgb33 Posted January 28, 2015 Share Posted January 28, 2015 Compile your code for both x86 and x64 (control F7), the autoit wrapper will include these lines to the top of the program. #AutoIt3Wrapper_Outfile=PostInvNS32.exe #AutoIt3Wrapper_Outfile_x64=PostInvNS64.exe #AutoIt3Wrapper_Compile_Both=y #AutoIt3Wrapper_UseX64=y Now the @ProgramFilesDir will Reference C:Program files Good Luck 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