Skip to content

Instantly share code, notes, and snippets.

@MikuAuahDark
Last active August 27, 2024 22:04
Show Gist options
  • Save MikuAuahDark/8726e8d948d113022a430f80a8a864a8 to your computer and use it in GitHub Desktop.
Save MikuAuahDark/8726e8d948d113022a430f80a8a864a8 to your computer and use it in GitHub Desktop.
Multiple Account Setup for Genshin Impact

Multi Account

Genshin Impact multi account in PC is bit annoying because you need to logout then login back. There are 2 ways to switch between account instantly and both requires the game not running.

Registry

Path: HKCU\SOFTWARE\miHoYo\Genshin Impact
Value: MIHOYOSDK_ADL_PROD_OVERSEA_h1158948810

That registry is used for your account credentials. If you remove that registry, you'll be logged out. If you rename this registry, login again, then rename again, you basically have multi-account login simply by copying the renamed registry over to same name.

This method is untested however. Some cache like friend that you've chatted may not get cleared properly. Basically this method is untested but simple.

Multiple User Account

Since the game stores the credentials in HKCU, it's possible to create new Windows user then run the game as that particular user. This is recommended method.

Create the New User

This step should only be done once for every account you want to use in-game.

So, in elevated Command Prompt (not sure about Powershell), run these commands:

net user <username> * /add
net localgroup Administrators <username> /add

Keep your <username> alphanumeric only. Command explanation for paranoids:

  1. It creates new user and prompts you for new password. You must specify password or configure the security policy to allow blank password login later.
  2. It adds the newly created user to Administrators group. This is required, otherwise the game will run as the other admin user which is not what you want!

Run the Game as Different User

There are various ways to do this:

Shift+Right Click the Shortcut

Easiest. If you have the shortcut in your desktop, just Shift+Right Click it then select "Run as Different User", enter the credentials of the user, then run the game.

The Runas Script

If you prefer some kind of shell script action, you can use this Batch script.

set LAUNCHER_PATH=C:\.genshinimpact\Genshin Impact\launcher.exe
setlocal enabledelayedexpansion

if "%1" == "" (
	set /P TARGET_USERNAME=User:
) else (
	set TARGET_USERNAME=%1
)

powershell -command "saps powershell -credential !TARGET_USERNAME! -argumentlist \"saps '%LAUNCHER_PATH%' -verb runas\" "

Change the LAUNCHER_PATH to your actual Genshin Impact launcher path. What's that command do is basically nesting Start-Process commands. First it runs powershell as our current user to run Start-Process. The next powershell runs powershell (again) as the target user then run the launcher by asking for administrator privileges.

It looks ugly because 2 reasons:

  1. It's not possible for Start-Process to run the launcher as different user and asking for administrator privileges at same time.
  2. It invokes powershell from Command Prompt. I don't know how to write the Powershell-equivalent script sadly.

Run as Different User in Start Menu

For this one, you need to tweak the registry to show "Run as Different User" in Start Menu. Based on this answer from SuperUser, you need to run this single command once to enable this functionality.

reg add HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\Explorer /v ShowRunAsDifferentUserInStart /t reg_dword /d 1

Afterwards, restart Windows Explorer either by logging out or by restarting it through Task Manager. The only downside (or the benefits) of this method is this shows "Run as Different User" for every app in Start Menu.

If everything's correct, the game launcher should pop up. Note that when you launch the game, it will have fresh configuration. If this is undesired (i.e. your game only have Japanese voice but the game forces English voice by default and you don't want to download the voice) then you need to hack yourself through the registry.

Note: You can run 2 launchers simultaneously but you can't launch 2 instance of the game though (the 2nd launcher will just close if you press "Launch" and both launchers will appear if you exit the game).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment