Click the Start button and type cmd in the search bar. Right-click the Command Prompt app and select Run as administrator. Then, type the following command and hit Enter:
systemreset -factoryreset
In the initial window, select Keep my files and follow the wizard to proceed with resetting Windows.