?
Solved

Restart a Program after Rebooting Windows

Posted on 2003-03-23
11
Medium Priority
?
151 Views
Last Modified: 2010-05-01
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
Comment
Question by:cbitservices
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 2
  • 2
  • +1
11 Comments
 
LVL 48

Expert Comment

by:AlexFM
ID: 8189514
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
 
LVL 1

Author Comment

by:cbitservices
ID: 8189522
Presumably the program name in the data should be the full path to the program?
0
 
LVL 1

Author Comment

by:cbitservices
ID: 8189526
Is this the same for all Windows operating systems from '95 to XP?
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 48

Accepted Solution

by:
AlexFM earned 300 total points
ID: 8189537
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
 
LVL 1

Author Comment

by:cbitservices
ID: 8189581
Is this the same for all Windows operating systems from '95 to XP?
0
 
LVL 1

Expert Comment

by:FunkyMeister
ID: 8199910
Using proper registry calls to write to that area of the registry, yes.  From 95 to XP.
0
 
LVL 1

Author Comment

by:cbitservices
ID: 8201501
It is now working nicely. Thanks,

Regards,

Colin.
0
 

Expert Comment

by:kdwalter
ID: 9101357
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
 
LVL 1

Author Comment

by:cbitservices
ID: 9101537
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
 

Expert Comment

by:kdwalter
ID: 9101649
Thanks, Colin.  I realize I need to ask this question in the C++ category.  

Have a good day.

Kris
0
 
LVL 1

Author Comment

by:cbitservices
ID: 9103937
No Problem Kris,

Good luck,

Colin.
0

Featured Post

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.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question