you need to go to the register edit . Go to the run menu
and type regedit and then press enter.
Then got to the HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion
By clicking in the currentversion in the right side of the panel you can see
After that you need to click on the programFilesDir and set the value as you wish. Here I set D:\program files and for this you need to create a folder named Program Files in the D drive.