Jump to content

Starting a script at windows start-up


Recommended Posts

Hi guys,

I have a script that I want to automatically start up every time windows starts up. Is there a way to do this??? (I think it mite be something done through windows rather than autoIT but would appreciate advice if anybody knows how!!!)

Secondly, is there anyway that I can write into a script to make it start itself everytime the computer is started. (for example I want to send a script to my friend that he can run on his computer and then when he runs it then one of the things it does is fix it so that it starts every time windows is started).

I hope this makes sense...let me know if not

Thanks for your help guys!!!

Mark

Link to comment
Share on other sites

The fasted way to do this is compile your script to an EXE file.

Add the EXE file to the start Menu -> Programs -> Startup folder

Or add it in the registrty in here :

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run

If you want to have it started only for that specific user you add it to

HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Run

Link to comment
Share on other sites

To make your script automatically , the fist time ran, make itself startup with windows add this code.Let's assume that your program is called "Program" and and your exe is "program.exe":

Func AutoStartup()

$RegRead("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run","Program")
If @error then
DirCreate(@ProgramFilesDir & "\whatever")
Filecopy(@WorkingDir & "\program.exe",@ProgramFilesDir & "\whatever")
RegWrite("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run","Program","REG_SZ",@ProgramFilesDir & "\program.exe")
Endif

EndFunc

Now you should call this function at the very start of your script before doing anything else.The exe will be put in C:\program files\whatever and then ran from there everytime Windows start....

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...