user1970090
user1970090

Reputation: 235

How to restart the PC in the first execution vb.net

I have an application that makes some changes in Windows , some of these changes require Windows restart to take effect . So , my question is : How can i restart the computer only for the first tool execution ?

Upvotes: 2

Views: 123

Answers (2)

Victor Zakharov
Victor Zakharov

Reputation: 26424

You can keep restart option in the registry. Depending on the type of changes you make, use either HKEY_CURRENT_USER or HKEY_LOCAL_MACHINE \ Software \ your brand \ your program \ create a DWORD key called RestartRequired.

If you have installation process, you can initially create this key with a value of 1. Then set to 0 just before closing and doing the restart. If you don't install anything, you can check whether RestartRequired=0 exists in the registry at a certain location. If it does not, it will create this value and commence restart.

Upvotes: 2

Darkwing
Darkwing

Reputation: 314

You can write in file if changes are made. Then you can check this file if restart occured.

Upvotes: 0

Related Questions