Multiple Dropbox Accounts on one computer – a Batch script to automate the process



A lot of people are in the situation where they want to use more than one Dropbox account on one (windows) machine (for whatever reason). The default way of doing this is the following: * create a new local user account * log in as that user and install Dropbox * log back in as the default user and use something like psexec to execute the installed Dropbox as the other user account while being logged in as default user To automate this process, I wrote the following script that also takes care of cosmetics like "hiding the newly created user from the login screen". After every execution, the file C:\dropboxen.bat contains one more line that executes the newly installed Dropbox as the right user. So this file is very suitable to be placed in shell:startup. Since the scripts creates users and makes modifications to the registry, administration privileges are needed to execute it. There is one odd thing: In the middle, this scripts that runs as an administrator, executes the Dropbox installer as a normal user. And since this installer needs admin privileges, it will ask for permission / a password again.
@ECHO OFF
SET /p username="Username: " %=%
SET /p password="Passwort: " %=%

SET autostartfile="c:\dropboxen.bat"

rem create user
net user %username% %password% /ADD
if errorlevel 1 ECHO Could not create user "%username%" && GOTO :EOF

rem Hide newly created user
REG ADD "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\SpecialAccounts\UserList" /v %username% /t REG_DWORD /d 0
if errorlevel 1 ECHO Could not create registry key && GOTO :EOF

rem Download Dropbox installer
wget "https://www.dropbox.com/download?plat=win" -O DropboxInstaller.exe
if errorlevel 1 ECHO Could not Download Dropbox Installer && GOTO :EOF

rem Execute Dropbox installer as target user
psexec -u "%username%" -p "%password%" "DropboxInstaller.exe"
if errorlevel 1 ECHO Dropbox Installation not successfull && GOTO :EOF
del DropboxInstaller.exe

rem add line to autostart file
ECHO psexec -d -u "%username%" -p %password% "C:\Users\%username%\AppData\Roaming\Dropbox\bin\Dropbox.exe" >> %autostartfile%
if errorlevel 1 ECHO Could not add autostart line && GOTO :EOF

ECHO done.
Dependencies: * psexec * wget (for example via cygwin). One can easily get rid of this dependency by modifying the lines where the script automatically downloads the Dropbox installer. If you have any suggestions, feel free to send me a pull request on github.

2 Replies to “Multiple Dropbox Accounts on one computer – a Batch script to automate the process”

  1. There is a shell command called RUNAS, which will do the same as psexec, but the user would have to enter the password again. However, maybe that's less of a barrier than requiring psexec to be present. Just my 2 cents.
    1. Thing is that the user then has to enter n passwords at startup (where n is the number of Dropbox accounts). And PsExec is an awesome tool that's shipped with the MS SysInternals And everybody should install SysInternals!

Leave a Reply

Your email address will not be published.