How to make the program start with windows?

Nipun

Whompy Whomperson
I am making a program, in which I want to add an option for "Start with windows". The problem is that I dont know how to do this. I know that there is a "Startup" folder somewhere in computer, and this is what I am gonna do:
-Include a shortcut with the program.
-When Start with windows is selected, copy the shortcut.
-Paste it to startup folder.

But, the problem is what is directory of startup folder? I know its:
"C:\Documents and Settings\USER NAME\Start Menu\Programs\Startup"
But what if user name is different?

Is there any other way to access startup folder?

I am using Game Maker Language to create this, but I am sure most of you have not heard of it, so talking about it is useless.
BTW I can also access the registry, so is it possible to get the username from registry? I have never used registry from a program so, and I dont want to ruin my and user's computer-so please be exact if possible. :)
 

nims11

BIOS Terminator
you can make use of the %USERPROFILE% environment variable to get the current user's directory. then the startup folder will be
%USERPROFILE%\Start Menu\Programs\Startup

or if you want to add it to the startup of all the users, use the %ALLUSERSPROFILE% environment variable.
and copy the file to %ALLUSERSPROFILE%\Start Menu\Programs\Startup
 

nims11

BIOS Terminator
Why don't you use registry (like most apps do).
you can add an entry to registry by creating a .reg file with the content as below and then executing it.
Code:
REGEDIT4
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run]
"Name of the program"="Application.exe"
 
OP
Nipun

Nipun

Whompy Whomperson
Why don't you use registry (like most apps do).
you can add an entry to registry by creating a .reg file with the content as below and then executing it.
Code:
REGEDIT4
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run]
"Name of the program"="Application.exe"
I have never used registry so I wanted to I avoid it.

Anyways, you saying that copy and paste the code you provided in notepad and save it as .reg file and execute it? :eek:
 
Last edited:

nims11

BIOS Terminator
Just a few questions:
I need not to change anything in code except "Name of program" and its directory, right?
right. you can even use environment variables in the application path.

it worked for me in XP. should work on 7 too.
 
OP
Nipun

Nipun

Whompy Whomperson
This is how I exactly did it:
Created a .reg file with exactly this:
Code:
REGEDIT4
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run]
"antimali"="D:\GM8 Stuff\AntiMali\Crylla-Degree SCAN\antimali.exe"
Executed it(double clicked, for testing)
Restarted the computer.
Nothing happened! :(

Am I supposed to do it in a different way?

you can make use of the %USERPROFILE% environment variable to get the current user's directory. then the startup folder will be
%USERPROFILE%\Start Menu\Programs\Startup

or if you want to add it to the startup of all the users, use the %ALLUSERSPROFILE% environment variable.
and copy the file to %ALLUSERSPROFILE%\Start Menu\Programs\Startup
NEVERMIND! I overlooked this post. Using this I am able to achieve it, thanks! :D :D
 

nims11

BIOS Terminator
@nipun in the .reg file, you need to give the application's executable and not the directory.
 

gagan007

Uhu, Not Gonna Happen!
you may also try to execute the program as a windows service. it is not difficult to achieve that either. let me know if you need more help on this.
if you have attained your goal using
%ALLUSERSPROFILE%\Start Menu\Programs\Startup
, it is fine..
 
Top Bottom