You start multiple instances of WhatsApp using --user-data-dir
flag providing the full path to the directory. For example:
E:\Temp\Whatsapp>WhatsApp.exe --user-data-dir=E:\Temp\Whatsapp\number1
or by creating a shortcut with the flag.
If directory does not exist it will be created (tested with WhatsApp-2.2019.6-full.nupkg
on Windows x64).
The rest of the document is just for historic purposes.
!!This tutorial is no longer applicable!!
This tutorial will explain how to make WhatsApp desktop application portable on Windows platform. Maybe this can work for other platforms as well.
For this to work NodeJs and asar package are required.
Firstly download latest version of WhatsApp. The following link contains all Windows (x64) releases:
https://web.whatsapp.com/desktop/windows/release/x64/RELEASES
Find the release with the highest number that has full
suffix. For example WhatsApp-0.2.2478-full.nupkg
The download link would be:
https://web.whatsapp.com/desktop/windows/release/x64/WhatsApp-0.2.2478-full.nupkg
Once downloaded unpack it (it's standard zip file), and go to the \lib\net45
folder. This folder contains the actual application. Copy the contents of that folder to your portable destination. For this example E:\WhatsAppPortable
.
Within that folder delete the squirrel.exe
to disable automatic updates.
If Node and asar are already installed, this step can be skipped.
Go to https://nodejs.org/download/release/latest/ and download version that ends with -win-x64.7z
.
Unpack that archive to E:\node
for example. Open cmd.exe
, go to Node's folder and install asar.
C:\>cd /d E:\node
E:\node>npm install asar
While at cmd unpack electron.asar
package from E:\WhatsAppPortable\resources\
folder using asar's extract archive
asar extract E:\WhatsAppPortable\resources\electron.asar E:\WhatsAppPortable\resources\electron_extract
Now go to E:\WhatsAppPortable\resources\electron_extract\browser\
and edit the init.js
file using any text editor.
Lines below are now in the electron_extract\browser\ app.js file and not in the init.js file.
In addition WhatsApp now has additional code with support for the
--user-data-dir
which can be used instead of this tutorial. Provided path has to be absolute for this to work. See comments below.
Now go to E:\WhatsAppPortable\resources\electron_extract\browser\
and edit the app.js
file using any text editor.
Find the following lines:
app.setPath('userData', path.join(app.getPath('appData'), app.getName()))
app.setPath('userCache', path.join(app.getPath('cache'), app.getName()))
Replace them with:
var appProfileDir = "Profile"
for (let arg of process.argv) {
if (arg.indexOf('--profile-dir=') === 0) {
appProfileDir = arg.substr(arg.indexOf('=') + 1)
}
}
var profilePath = path.join(path.dirname(process.execPath), appProfileDir)
app.setPath('userData', profilePath)
app.setPath('userCache', profilePath)
Save the file and pack it with asar:
asar pack E:\WhatsAppPortable\resources\electron_extract E:\WhatsAppPortable\resources\electron.asar
The electron_extract
folder in E:\WhatsAppPortable\resources\
can be deleted now.
In the previous step the --profile-dir
switch is added and Profile
is set as default folder. If the WhatsApp is started without the switch it will create and use Profile folder.
If it is started like this:
WhatsApp.exe --profile-dir=MySecondNumber
it will create MySecondNumber folder ad use it as a profile folder.
This provides the ability to run multiple instances of WhatsApp with different profiles on the same computer.
Adding something like this profile-dir switch can probably be used to make any Electron application portable as long it is not using appData path elsewhere the code.
I made my own method to run multiple whatsapp desktops at the same time. Its a pretty simple setup without any issues as far as I can tell.
runas.exe /savecred /user:DummyUser "C:\Users\DummyUser\AppData\Local\WhatsApp\WhatsApp.exe"
Important: Before you make any changes, make sure to understand that you'll be modifying the Windows registry, which could be a dangerous game that can cause irreversible damage to your computer when changes are not done properly. It's recommended that you do a full backup of your system before proceeding. You've been warned!
a) Open regedit as admin
b) navigate to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon
c) Right-click the Winlogon, select New, and click Key. Name the new key SpecialAccounts.
d) Right-click the SpecialAccounts key, select new, and click Key. Name the new key UserList.
e) Inside of UserList, right-click, select New, and click DWORD (32-bit) Value. Name the new DWORD key with the name of the account you're trying to hide.
f) Double-click the new DWORD key and make sure its data value is set to 0.
g) Sign-out and you'll now notice that the account will no longer be available on the sign-in screen.
Note: In order to make a hidden account visible again, you'll have to go back to the registry UserList key using the steps mentioned above, and making sure to change the user name data key value from 0 to 1.
Enjoy! I currently have three WhatsApp Desktops running at once and it works great!