Changing the location of the iTunes Music library XML files
In iTunes it’s very easy to change the location of your music folders – simply change the “iTunes Music folder location” option in Preferences:

However this only tells iTunes where your music is stored – it does not tell iTunes where to put your iTunes Music Library.xml file. This file and its associated itl files store extra information about your music library – such as your ratings, play counts etc. This information is almost as vital as the music itself, but unfortunately cannot be moved from your Windows My Music folder.
To work around this you need to move the location of your My Music folder. To do this (assuming you’re using XP), close iTunes and then go to Start -> Run and type “regedit”, then press Enter.
Navigate to the following section in the Registry Editor:
HKEY_CURRENT_USER
-> Software
-> Microsoft
-> Windows
-> Current Version
-> Explorer
-> User Shell Folders
You’ll see in the right Window a list of folders such as “AppData”, “Cache”, “Favourites” etc. The Data column will tell you where these folders are located on your hard drive. Have a look and see if you have an entry for “My Music”. If you do, simply right click on it, select Modify and enter a new path to where you want the “My Music” folder to be.

If you do not have a My Music folder then go to Edit > New > Expandable String Value. Enter “My Music” as the name of this value, and then right click on it, select Modify and enter the path as above.
You should end up with something like this:

iTunes will now look for its XML file in [the path you've entered]\iTunes\, so its import that you copy your existing iTunes folder to the new location before starting iTunes.

