On my power cable, (the thing that plugs into the wall, and laptop to charge it) well in the middle of the cord, there is a rectangle black box. What is it called, and what is the purpose of it?
its a transformer to cut the mains plug voltage down to the same voltage as the battery which will be around 16volts to 20 volts for a laptop,the desktop PC will have the same transformer built into the tower casing beside the fan,but you just cannot see it, and there will be a voltage selector switch for the country you are using it in ie-UK =220-240volts, USA=110 volts or similar,both the laptops and desktops use the same internal operating low voltages,and mains voltage would fry everything inside ,that's why they are fitted with the transformers.