How to Run Multiple WeChat Instances on Windows: Batch Script Trick & Deep Singleton Analysis

This article explains how a simple batch file can launch two or more simultaneous WeChat processes on Windows, and provides a detailed reverse‑engineering analysis of WeChat's singleton enforcement using mutexes, API monitoring, and IDA disassembly to reveal why the trick works.

Java Tech Enthusiast
Java Tech Enthusiast
Java Tech Enthusiast
How to Run Multiple WeChat Instances on Windows: Batch Script Trick & Deep Singleton Analysis

The author demonstrates a straightforward method to run multiple WeChat instances on a Windows PC by creating a batch file that launches the executable multiple times, and then explains the underlying technical reasons.

Batch script solution

Creating a batch file with the following commands starts two independent WeChat processes:

start D:\WeChat\WeChat.exe
start D:\WeChat\WeChat.exe

Adding another start line launches a third instance. Double‑clicking the batch file instantly creates the desired number of processes.

WeChat's singleton mechanism

WeChat normally enforces a global singleton by creating a named mutex. When a second instance is started, the program attempts to create the mutex _WeChat_App_Instance_Identity_Mutex_Name. The call to CreateMutex succeeds, but GetLastError returns 0x000000b7 (ERROR_ALREADY_EXISTS), indicating that another instance is already running.

Tools used for the analysis:

Process Explorer – to view kernel objects and locate the mutex.

API Monitor – to capture CreateMutex and GetLastError calls.

ID A – to disassemble WeChatWin.dll and locate the code that creates the mutex.

The mutex creation occurs in function sub_108e26d0, which is called by sub_108e2660. The decision logic can be expressed as:

if (CreateMutex() == SUCCESS) {
    launch WeChat
} else {
    if (FindWindow() == SUCCESS) {
        BringWindowToTop(existing window)
    } else {
        launch WeChat
    }
}

If the mutex cannot be created, the program checks for the presence of either the main window ( WeChatMainWndForPC) or the login window ( WeChatLoginWndForPC). If found, it brings that window to the foreground and exits; otherwise it starts a new instance.

Why the batch script bypasses the singleton check

When the batch file launches multiple processes almost simultaneously, the second process attempts to create the mutex before the first process has finished creating its window. Consequently, the CreateMutex call fails, but the subsequent window‑search logic does not find an existing window yet, so the program proceeds to start a new instance, allowing multiple copies to run.

Additional observations

Inside WeChatWin.dll the exported function responsible for the startup is named StartWaChat, a likely typo of "WeChat". Later versions of the DLL have corrected this name.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

WindowsReverse engineeringSingletonWeChatIDAProcess Explorerbatch-scriptapi-monitor
Java Tech Enthusiast
Written by

Java Tech Enthusiast

Sharing computer programming language knowledge, focusing on Java fundamentals, data structures, related tools, Spring Cloud, IntelliJ IDEA... Book giveaways, red‑packet rewards and other perks await!

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.