DarkRage Posted July 30, 2012 Share Posted July 30, 2012 Hi, I'm new here. I'm Spanish, so sorry for my English. My problem is this: I have these paths extracted of a value reg: Regedit --> "C:\windows\regedit.exe -s /hide ('System')" other reg --> C:\windows\otherfile.exe other reg2 --> C:\windows\otherfile2.exe other reg3 --> C:\windows\otherfile3.exe -h other reg4 --> C:\windows\otherfile4.exe /local I just want the path of all: C:\windows\regedit.exe C:\windows\otherfile.exe C:\windows\otherfile2.exe C:\windows\otherfile3.exe C:\windows\otherfile4.exe But some paths have other signs after the extension. I've tried to do it with this function "StringSplit" for to delimit the signs and get only the path, but this sign can be in the path. For example: Other reg --> "C:\windows\other-file.exe So, I've tried with this function "_PathSplit": For $i = 1 To 100 Local $var = RegEnumVal("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", $i) If @error <> 0 Then ExitLoop Local $var2 = Regread("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", $var) Local $szDrive, $szDir, $szFName, $szExt Local $TestPath = _PathSplit($var2, $szDrive, $szDir, $szFName, $szExt) msgbox(0,"",$TestPath[1] & $TestPath[2] & $TestPath[3] & ".exe",0) Next I think that with this example would extract the path, but it extract all, including -s /hide ('System')",-h,/local...etc thank you for your consideration of this matter and sorry for the wrong words. Link to comment Share on other sites More sharing options...
Danyfirex Posted July 30, 2012 Share Posted July 30, 2012 (edited) hi mate, maybe you can use stringmid to get only the extension. #include <File.au3> #include <Array.au3> Local $szDrive, $szDir, $szFName, $szExt $claveleida="C:windowsotherfile3.exe -h" Local $TestPath = _PathSplit($claveleida, $szDrive, $szDir, $szFName, $szExt) $splitextension=StringMid($szExt,1,4) msgbox(0,"",$TestPath[1]&$TestPath[2]&$TestPath[3]&$splitextension) Saludos también hablo español. Edited July 30, 2012 by Danyfirex Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut Link to comment Share on other sites More sharing options...
DarkRage Posted July 30, 2012 Author Share Posted July 30, 2012 Hi DanyFirex, thanks for help. Your code works, but only works with your string. I need to do this with all values that I get, obviously, I ignore if the value is normal or it has signs after path. If value is normal, get the path, it's easy... But, get the path without signs it's difficult. I need obviate the final signs, in other words, I need the path, from first word of drive to the final word of extension. Link to comment Share on other sites More sharing options...
Danyfirex Posted July 30, 2012 Share Posted July 30, 2012 ok right so use stringsplit, You split the extension ontil " " one space. look #include #include Local $szDrive, $szDir, $szFName, $szExt $claveleida="C:windowsotherfile3.exe -h" Local $TestPath = _PathSplit($claveleida, $szDrive, $szDir, $szFName, $szExt) $splitextension=StringSplit($szExt," ") msgbox(0,"",$TestPath[1]&$TestPath[2]&$TestPath[3]&$splitextension[1]) Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut Link to comment Share on other sites More sharing options...
UEZ Posted July 30, 2012 Share Posted July 30, 2012 Try this: $i = 1 While True Local $var = RegEnumVal("HKLMSOFTWAREMicrosoftWindowsCurrentVersionRun", $i) If @error <> 0 Then ExitLoop Local $var2 = Regread("HKLMSOFTWAREMicrosoftWindowsCurrentVersionRun", $var) Local $sRes = StringRegExpReplace($var2, '["]|(.*w+.w+)(.*)', "$1") If $sRes <> "" Then ConsoleWrite($var2 & @LF & $sRes & @LF & @LF) $i += 1 WEnd Br, UEZ 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...
DarkRage Posted July 30, 2012 Author Share Posted July 30, 2012 (edited) Thanks to both. Danyfirex, thanks for code, but it doesn't work very well. UEZ, thank you very well, your code works perfectly I have a doubt, what does mean this line? $sRes = StringRegExpReplace($var2, '["]|(.*w+.w+)(.*)', "$1") Thanks to both. Edited July 30, 2012 by DarkRage Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted July 30, 2012 Moderators Share Posted July 30, 2012 Look up StringRegExpReplace in the help file, and you will be able to read all about it. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
DarkRage Posted August 1, 2012 Author Share Posted August 1, 2012 okey JLogan 3o13, I'll do it. Thanks for your help guys. 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