Sign in to follow this  
Followers 0
tricky808

Runwait Returns Invalid Function Using Scanreg

3 posts in this topic

I'm using scanreg.exe (from Win2K Res Kit) to search the registry for keywords and dump the information into a file that I parse at a later time. Here is the code:

FileInstall("scanreg.exe","scanreg.exe")
         $shortPathScanReg = FileGetShortName(@ScriptDir & "\scanreg.exe")
         $hiveRoot = StringSplit("HKEY_LOCAL_MACHINE,HKEY_CLASSES_ROOT,HKEY_CURRENT_USER,HKEY_USERS",",")
         For $h = 1 to 4
            $returnCode = RunWait(@ComSpec & " /c " chr(34) & $shortPathScanReg & " /s " & $searchString & " /r " & $hiveRoot[$h] & " -kvd >C:\test\regFile.txt" & chr(34),"",@SW_HIDE)
            MsgBox(0,"returnCode",$returnCode)
         Next

So when I run the command line from a console window, it runs and dumps the regscan stream into c:\test\regFile.txt.

But no such luck when I fire the RunWait command from the autoit script. returnCode responds with error 1: incorrect function. So what gives?

TIA


Aut viam inveniam aut faciam

Share this post


Link to post
Share on other sites



$returnCode = RunWait(@ComSpec & " /c " & chr(34) ...

I lost count the number of times I make this mistake

<{POST_SNAPBACK}>

Thanks for the reply. My problem was actually due to a previous FileOpen call without performing a FileClose before piping my command-line into it. But good catch nonetheless.

Aut viam inveniam aut faciam

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0