If you're currently using Windows 7, 8 or 8.1 versions, you can upgrade to the latest version of the operating system , Windows 10, through the auto update feature that appears on the system's taskbar.

You need to click on the Windows icon, which will give you step-by-step instructions to download the update automatically. But, to maintain the huge demand, Microsoft is maintaining a queue for that. So, if you want your computer to be updated to Windows 10 immediately, you might come across a bug, codenamed as 80240020, and would get stuck midway. Here's how to fix the error:

Once you see a dialogue box with a failed installation status, just click on the 'close' button.
Open the Windows Explorer and navigate to the C:$Windows~BT folder. Before locating the folder, make sure to check the 'Show Hidden Items' option.

Open the folder and delete as many items you can as Windows won't allow you to erase everything inside the folder due to permission issue.

Navigate to the C:WindowsSoftwareDistributionDownload folder and erase all the data in it.

Now, run Windows update on the system, ensure your automatic system update is on.

Click on the Start button, search CMD and right click on the icon and choose Run as Administrator.

The command prompt will appear on the screen. Type wuauclt.exe/updatenow and press Enter.

Now, the update screen will appear on screen, check for updates and the dialogue box will prompt as it has began downloading the Windows 10.

Once the downloading is complete, the system will prompt Preparing for installation, which means your system is ready to be updated.

Follow the instructions appears on screen for getting it done.

Source- RemondPie