Jump to content
Sign in to follow this  

Startup Logger

Recommended Posts

I made this handy little function/snippet while working on another project. It logs the programs that start up with windows to a text file. Hope it is as useful to someone out there as it was to me :)

;Logs all startup items from a reg key to a file
Func _LogStartupItems($_outputFile, $_runKey = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run")
    Local $_itemCount = 1
    Local $_itemPath
    Local $_itemName = RegEnumVal($_runKey, $_itemCount)
    While Not @error
        $_itemCount += 1
        $_itemPath = RegRead($_runKey, $_itemName)
        If Not @error Then
            FileWriteLine($_outputFile, $_itemName & "; Path:" & $_itemPath)
        $_itemName = RegEnumVal($_runKey, $_itemCount)
EndFunc   ;==>_LogStartupItems

;Example Usage ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Dim $myStartupKeys[5]
$myStartupKeys[0] = 4
$myStartupKeys[1] = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run"
$myStartupKeys[2] = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce"
$myStartupKeys[3] = "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run"
$myStartupKeys[4] = "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\RunOnce"

For $i = 1 To $myStartupKeys[0]
    _LogStartupItems(@DesktopDir & "\" & @UserName & "-StartUp" & ".txt", $myStartupKeys[$i])

Share this post

Link to post
Share on other sites

Might be handy; but you forgot @StartupDir and @StartupCommonDir which are not

referenced in the registry

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...