• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 162
  • Last Modified:

Restart a Program after Rebooting Windows

I have created an installation CD to install a system that I have written. The installation routine includes several different steps depending on the operating system, and after some of these steps Windows must be rebooted before continuing. I would therefore like to make the installation CD run again automatically after Windows restarts if possible. I thought there should probably be a way of doing this, maybe by adding a shortcut to the Startup menu, or similar. This would then need to be disabled after the last step of course. Any suggestions on how to achieve this would be gratefully received. Thanks,

Regards,

Colin.
0
cbitservices
Asked:
cbitservices
  • 6
  • 2
  • 2
  • +1
1 Solution
 
AlexFMCommented:
Write a command to HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Runonce or HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Runonce.
Registry entry should be of type REG_SZ, with any name and program name in data. This command is executed after reboot only once, and Windows deletes this entry itself.
0
 
cbitservicesAuthor Commented:
Presumably the program name in the data should be the full path to the program?
0
 
cbitservicesAuthor Commented:
Is this the same for all Windows operating systems from '95 to XP?
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
AlexFMCommented:
1) Full path (and parameters, if you need). If program is available through PATH, full path is not required.

2) Yes.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/setupapi/setup/run_and_runonce_registry_keys.asp
0
 
cbitservicesAuthor Commented:
Is this the same for all Windows operating systems from '95 to XP?
0
 
FunkyMeisterCommented:
Using proper registry calls to write to that area of the registry, yes.  From 95 to XP.
0
 
cbitservicesAuthor Commented:
It is now working nicely. Thanks,

Regards,

Colin.
0
 
kdwalterCommented:
How do you determine the full path if the runonce value needs to point to a file on a CD drive? (ie. no full path you can know in advance because the drive letter may be different from machine to machine).

Thanks,

Kris
0
 
cbitservicesAuthor Commented:
In my program I just saved the program's "app.path & "\" & filename value. The application knows this wherever it is run from so it can always save the appropriate location in the registry. i.e., the code looks something like this (using the appropriate registry class)

s_Registry.ClassKey = HKEY_CURRENT_USER
s_Registry.SectionKey = "Software\Microsoft\Windows\CurrentVersion\Runonce"
s_Registry.ValueKey = "Case Family Installation"
s_Registry.ValueType = REG_SZ
s_Registry.Value = App.Path & "Setup.exe"

Hope that helps...

Regards,

Colin.
0
 
kdwalterCommented:
Thanks, Colin.  I realize I need to ask this question in the C++ category.  

Have a good day.

Kris
0
 
cbitservicesAuthor Commented:
No Problem Kris,

Good luck,

Colin.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 6
  • 2
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now