First, launch Minecraft and login to the launcher.
You should see an option at the lower right stating "New Profile," press it as seen
Then, after you press it, a new window should open up with multiple options, including
the "Profile Name" and the "Game directory," as seen below:
You can set the "Profile Name" to anything you want.
For "Game directory," you must specify where you want the game to store it's data in.
It can be anywhere that the launcher has permission to edit.
In the image below, we set the directory to "C:\ProgramData\.minecraft"; once you are
done with this, simply press "Save Profile".
Afterwards, from the dropdown, choose the new profile you made.
Then, you're done!
Simply Play, and the game will now store data in the place you specified.