Jump to content

Recommended Posts

Ther are a few places in the registry u can put a ref.

If it's only once the script should run then.

1. the script only runs under current user

2. is global or for all users

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Runonce]

"NAME"="PATH TO FILE" ; Eg. "C:\\MY file.exe" rember to use \\ and not \ in paths

or

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce]

"NAME"="PATH TO FILE" ; Eg. "C:\\MY file.exe" rember to use \\ and not \ in paths

If you want it to run every time the ps starts, then you have 2 choices.

1. the script only runs under current user

2. is global or for all users

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run]

"NAME"="PATH TO FILE" ; Eg. "C:\\MY file.exe" rember to use \\ and not \ in paths

or

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run]

"NAME"="PATH TO FILE" ; Eg. "C:\\MY file.exe" rember to use \\ and not \ in paths

Link to post
Share on other sites

$regPath = "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run"
$progName = "Notepad"
$filePath = "C:\Windows\notepad.exe"
regWrite($regpath, $progName, "REG_SZ", $filePath)

<{POST_SNAPBACK}>

Wat would it be for my program? Say the name of it is test.exe

Would it be

$regPath = "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run"
$progName = "test"
$filePath = "C:\Windows\test.exe"
regWrite($regpath, $progName, "REG_SZ", $filePath)

<{POST_SNAPBACK}>

Link to post
Share on other sites

This might be easier ?

$regPath = "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run"
$progName = StringTrimRight(@ScriptName, 4)
$filePath = FileGetShortName(@ScriptFullPath)
regWrite($regpath, $progName, "REG_SZ", $filePath)
Link to post
Share on other sites

How would i do an

If Than Else

for it?

Like

If it already exsists in the registry for startup than end if

Else create it in the registry for start up

End If

<{POST_SNAPBACK}>

You need to create a $var = regread(String)

$var = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", "String")
if Not $var = "prog.exe" then
MsgBox(0, "Prog","Dont exist")
Else
MsgBox(0, "Prog", "Eksist")
EndIf
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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...