Skip to content

Instantly share code, notes, and snippets.

@sinewalker
Last active January 6, 2018 21:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sinewalker/40eeab54eb047292d39d5a37bb9fbb82 to your computer and use it in GitHub Desktop.
Save sinewalker/40eeab54eb047292d39d5a37bb9fbb82 to your computer and use it in GitHub Desktop.
Temporarily change %APPDATA% for portable settings (Windows: e.g. Minecraft)

Need to take %APPDATA% directory data to another PC? For example Minecraft game saves to take in to a school for projects, or to a friend's house. The tricky part is: %APPDATA% has a different location depending on the version of Windows. Yay Microsoft, thanks once again.

The good news is that many Windows programs do use the environment variable to locate this folder, so you can just override it and launch your game or whatever from a .cmd / .bat file.

In the case of Minecraft on a USB:

  1. Make a folder structure on the USB drive for it (assume E: is the USB):
    • E:\Minecraft
    • E:\Minecraft\bin
    • E:\Minecraft\data
  2. Copy your Minecraft binaries into the \bin folder and your %APPDATA%\.minecraft into \data
  3. Make a batch file to launch the game (below) and save it to E:\Minecraft\minecraft.bat
  4. Lanch the batch file to play the game

This will run the game from the USB, which could be slow. Also it'll still require Java to be installed.

set APPDATA=%CD%\data
bin\minecraft.exe
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment