digitalmars.D.learn - Run program at startup
- SaltySugar (1/1) Feb 08 2013 How to run my program when computer starts?
- Dicebot (3/4) Feb 08 2013 This question is irrelevant to D and is operating system
- rumbu (31/35) Feb 08 2013 If you want D to become popular, that's not an appropiate answer
- bearophile (8/12) Feb 08 2013 I agree that it's important to be gentle.
How to run my program when computer starts?
Feb 08 2013
On Friday, 8 February 2013 at 15:06:24 UTC, SaltySugar wrote:How to run my program when computer starts?This question is irrelevant to D and is operating system specific. It is better suited for stackoverflow & Co.
Feb 08 2013
On Friday, 8 February 2013 at 15:08:06 UTC, Dicebot wrote:On Friday, 8 February 2013 at 15:06:24 UTC, SaltySugar wrote:If you want D to become popular, that's not an appropiate answer in the d.learn section. I'm sure that if someone will ask the redirect to an external forum. --- To run at startup for all users, the most used way for a program to do this is to create a string value in the following registry keys: - HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\Current Version\Run if the program will run every time. - HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\Current Version\RunOnce if the program will run once. In D, this will look like this: import std.windows.registry; void runMeAtStartupEveryTime(string exeName) { auto key = Registry.localMachine.getKey(`SOFTWARE\Microsoft\Windows\CurrentVersion\Run`, REGSAM.KEY_SET_VALUE); key.setValue("runme", exeName); } int main(string[] args) { runMeAtStartupEveryTime(args[0]); return 0; } Of course, you must have the appropriate rights to do this. This approach is Windows specific, I don't have any hint about another OS.How to run my program when computer starts?This question is irrelevant to D and is operating system specific. It is better suited for stackoverflow & Co.
Feb 08 2013
rumbu:If you want D to become popular, that's not an appropiate answer in the d.learn section. I'm sure that if someone will answer, not a redirect to an external forum.I agree that it's important to be gentle. (I remember the C newsgroups where many questions received rude answers like: "Not a C Standard question" (because the C standard leaves many essential things to OS-specific functions or compiler-specific implementations)). Bye, bearophile
Feb 08 2013