![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | Help and feedback with script searching the registry with regular expression Hi Hope someone might help me out, since I'm stuck. I have to search the registry of several computers to find if there is a "PendingFileenameOperation" waiting. After some try and error, I've come up with this solution where I read the registry and add all entries' to an array, and then add each arrayitem to a string. I then intend to search the string for a certain path. If the count is above 0 I have a PendingFileRenameOperation" that requires a reboot. My problem is as follows: 1) Is this the best way to solve this problem 2) I cant get my regular expression to work. The code I've come up with is as follows: Dim objShell dim strPending, strSessionManager , strAllText Dim arrFiles ''array containing files that are being renamed Set objRegEx = CreateObject("VBScript.Regexp") objRegEx.Global = True objRegEx.Pattern = "C:\Norman" ''regular expression finding all entries containing "c:\norman\" strPending = "PendingFileRenameOperations" ''The regkey we're going to read strSessionManager="HKLM\System\CurrentControlSet\Control\Session Manager\" ''the registry Set objShell = CreateObject("WScript.shell") arrFiles=objShell.Regread(strSessionManager & strPending) 'put all entries in registry into the array for each StrFile in arrFiles strAllText= strAllText & " " & strFile ''add all entries into one long string with spaces next set colMatches = objRegEx.Execute(strAllText) if colMatches.count > 0 then ''Do something if there are keys in the given directory that is pending a filerename operation. end if Any feedback would be greatly appreciated. /Regards L. |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Regular Expression help C# | .NET General | |||
| Regular Expression for ../ | .NET General | |||
| Help with a regular expression | VB Script | |||
| regular expression help | VB Script | |||
| Regular expression notes | PowerShell | |||