Jump to content

checking startup


Recommended Posts

im trying to script something that will check to see if an app is set for startup (registry and profile startup directory)

(i realize theres current user for both registry and userprofile\startup - but if i get this working then it will be the same logic for those)

neither are working hehe

registry: trying to check the string values for every entry in hklm\software\microsoft\windows\currentversion\run

and if it matches with a particular path to an exe then ill know its set for startup in the reg

profiledir: trying to "getshortcut" for the *.lnk files and also compare them to a an exe link.

;check registry

For $i = 1 To 100

$var = RegEnumVal("hkey_local_machine\software\microsoft\windows\currentversion\run", $i)

If @error <> 0 Then MsgBox(0, "", "error")

For $j = 1 To 100

$tar = RegRead("hkey_local_machine\software\microsoft\windows\currentversion\run", $var)

If @error <> 0 Then MsgBox(0, "", "error")

;MsgBox(4096, "Value", $tar)

If $tar = "c:\blp\wintrv\wintrv.exe" Then

MsgBox(0, "", "wintrv already in startup")

EndIf

Next

Next

;check startup dir

$search=FileFindFirstFile("c:\documents and settings\all users\start menu\programs\startup\*.lnk")

If $search = -1 Then

MsgBox(0, "Error", "No files/directories matched the search pattern")

Exit

EndIf

While 1

$file = FileFindNextFile(FileGetShortcut("c:\documents and settings\all users\start menu\programs\startup\" & $search))

If @error Then ExitLoop

;MsgBox(4096, "File:", $file[0])

If $tar = "c:\blp\wintrv\wintrv.exe" Then

MsgBox(0, "", "wintrv already in startup")

EndIf

WEnd

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...