Made the autostart code more general

It works on Windows 7 and I think Vista is the same, but it probably needs extra code to handle Windows XP and 8