ALIENQuake Posted May 5, 2011 Share Posted May 5, 2011 (edited) Hi. Some time ago i create this bat file: @echo off FOR /F "tokens=2* delims= " %%A IN ('REG QUERY "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\WinRar.exe" /v "Path"') DO SET WinRarInstallDir=%%B xcopy *.* "%WinRarInstallDir%" /y /q /e echo "%WinRarInstallDir%" exit but due some unknown reason, it don't work on VISTA/7. I try to solve this but I'm unable to do it. It is possible to write AutoIt replacement for such simple .bat file ? What this .bat file do: 1. Read registry and check what is in "Path" in "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\AppPaths\WinRar.exe" 2. Set WinRarInstallDir as what is in "Path" 3. Copy all files with current dir to %WinRarInstallDir% I don't have experience with AutoIt. Can someone help me with this ? Edited May 5, 2011 by ALIENQuake Link to comment Share on other sites More sharing options...
hannes08 Posted May 5, 2011 Share Posted May 5, 2011 (edited) $s_path = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\AppPaths\WinRar.exe", "path?") FileCopy(@SCriptDir & "\*", $s_path) For RegRead you'll need the registry path and the "key" you want to read. FileCopy supports Wildcards. Edit: Oh, welcome to the AutoIT forum! And: A good place to start with AutoIT is the very useful helpfile. Edited May 5, 2011 by Hannes123 Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler] Link to comment Share on other sites More sharing options...
ALIENQuake Posted May 5, 2011 Author Share Posted May 5, 2011 (edited) Ok, i was able to compile it but it don't work Files in current dir (with i execute compiled script) aren't copied to WinRar dir and i get this strange file with chines letters And how i can get rid of this:in VISTA/7 ? Edited May 5, 2011 by ALIENQuake Link to comment Share on other sites More sharing options...
hannes08 Posted May 5, 2011 Share Posted May 5, 2011 1. You should test / check whether your script really can read the registry value, just do a MsgBox(0,"regread:", $value_or_whatever) 2. Check the return code of FileCopy() e.g. $returncode = FileCopy($x, $y), read the help file for a list of returnvalues Maybe you can find a solution then. I can't help you with the the Vista/7 error message, because I can't read it. Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler] Link to comment Share on other sites More sharing options...
GEOSoft Posted May 5, 2011 Share Posted May 5, 2011 Try putting #RequireAdmin at the top of the script. @Hannes123 You don't need to be able to read that dialog. It's easily recognized as being the UAC prompt window. George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
ALIENQuake Posted May 5, 2011 Author Share Posted May 5, 2011 (edited) #RequireAdmin $var = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion", "ProgramFilesDir") MsgBox(4096, "Program files are in:", $var) $var = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\AppPaths\WinRar.exe", "Path") MsgBox(4096, "WinRar.exe is in:", $var) FileCopy(@SCriptDir & "\*", $var) Fist command works, we can see C:\Program files in message box. Second command shows empty window ! Why ? It's is the same script, only with different parameters Edited May 5, 2011 by ALIENQuake Link to comment Share on other sites More sharing options...
JFX Posted May 5, 2011 Share Posted May 5, 2011 You made a typo AppPaths --> App Paths Link to comment Share on other sites More sharing options...
ALIENQuake Posted May 5, 2011 Author Share Posted May 5, 2011 Omg THX !! Let me dig it more now 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