-
-
Save alastorid/6ee0831b972d5260b84639dd34588013 to your computer and use it in GitHub Desktop.
For running multiple MS Teams accounts side by side. Save this with the name of the MS Teams profile you wish to use. When launched, many folders plus junctions will be created in your user profile. And all running team.exe will be killed to be respawned. See https://danielsmon.com/2020/04/02/multiple-ms-teams-accounts-on-the-desktop/.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@ECHO OFF | |
echo don't try this at home | |
SET SHOULD_PAUSE= | |
REM kill them all !!! | |
wmic process where name="teams.exe" call terminate || taskkill /f /im teams.exe || echo o.O | |
REM Uses the file name as the profile name | |
call :teamsMC "%~n0" | |
call :teamsMC "default" | |
IF DEFINED SHOULD_PAUSE ( | |
echo Setup complete^! Have a look^! Hope you are happy with it. | |
pause | |
) | |
goto :eof | |
:teamsMC | |
REM Uses the first arg as the profile name | |
SET MSTEAMS_PROFILE=%~1 | |
SET TRUE_USERPROFILE=%USERPROFILE% | |
SET USERPROFILE=%LOCALAPPDATA%\Microsoft\Teams\CustomProfiles\%MSTEAMS_PROFILE% | |
IF "%MSTEAMS_PROFILE%" EQU "default" ( | |
SET USERPROFILE=%TRUE_USERPROFILE% | |
) | |
ECHO - Using profile "%MSTEAMS_PROFILE%" | |
REM Ensure there is a downloads folder to avoid error described at | |
REM https://gist.github.com/DanielSmon/cc3fa072857f0272257a5fd451768c3a | |
IF NOT EXIST "%USERPROFILE%" ( | |
mkdir "%USERPROFILE%" | |
) | |
REM Fixes missing "Downloads & Desktop" folder, and ensure that Documents and Pircures are there | |
for %%d in (Downloads Desktop Documents Pictures) do ( | |
IF NOT EXIST "%USERPROFILE%\%%d" ( | |
mklink /J "%USERPROFILE%\%%d" "%TRUE_USERPROFILE%\%%d" || ( | |
echo Oh no, USERPROFILE on DFS? | |
rem mkdir "%USERPROFILE%\%%d" | |
) | |
SET SHOULD_PAUSE=1 | |
) | |
) | |
ECHO - Launching MS Teams with profile "%MSTEAMS_PROFILE%" | |
pushd "%TRUE_USERPROFILE%\AppData\Local\Microsoft\Teams" && ( | |
"%TRUE_USERPROFILE%\AppData\Local\Microsoft\Teams\Update.exe" --processStart "Teams.exe" | |
popd | |
) | |
SET USERPROFILE=%TRUE_USERPROFILE% | |
goto :eof |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment