top of page

Reload Windows Registry Values via Java


Let's see how we can reload Windows registry from Java by executing PowerShell script.

Sometime, we may have to change the key and value of Windows Registry according to the system requirement.


But sometime, it will not effect the changes immediately because some of the Windows services took the registry values during the System boot only. So, reloading the Registry keys and values can solve to effect the changes.


After finish changing the registry, we need to run the following PowerShell script to let the Windows reload the registry keys and values for its services.


There is another way to reload the registry values which is to restart the windows explorer.exe. But it is not the good way because it seem like Windows is crashed and all of the opened folder will be closed. It will make the user feels worried about their PC situation.


So, how do we execute PowerShell script from Java?


There is a API named jPowerShell which is a simple Java API that allows to interact with PowerShell console. (https://github.com/profesorfalken/jPowerShell).


In the following code, we can execute the PowerShell script file with given config.

If the response is True, the PowerShell script is executed successfully.


Comments


Single post: Blog_Single_Post_Widget
bottom of page