:: Find the Dropbox installer in this script's folder and run it silently, :: specifying %ProgramFiles%\Dropbox as the installation folder instead of :: the %APPDATA% subfolder it uses by default. set bin32=%ProgramFiles% if "%PROCESSOR_ARCHITECTURE%" == "AMD64" set bin32=%ProgramFiles(x86)% for %%I in ("%~dp0Dropbox*.exe") do set installer=%%~I start /wait "Dropbox Installer" "%installer%" /S /D=%bin32%\Dropbox :: The installer starts the Dropbox application right after installing it. :: Kill that, because it will be running with admin rights, possibly under :: the wrong user account. taskkill /F /IM "Dropbox.exe" /T :: Find the current user's Start Menu folder, where the Dropbox installer :: puts launcher shortcuts. set rkey=HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders set rval=Start Menu for /f "tokens=3*" %%U in ('reg query "%rkey%" /v "%rval%"') do set StartMenu=%%~V :: Find the global Start Menu folder, where some of the Dropbox launcher :: shortcuts need to be moved to. set rkey=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders set rval=Common Start Menu for /f "tokens=4*" %%U in ('reg query "%rkey%" /v "%rval%"') do set CommonStartMenu=%%~V :: Make the Dropbox app and Dropbox website shortcuts accessible to all users. :: Leave the Uninstall shortcut where it is; it's of no use to limited accounts. set menu=Programs\Dropbox mkdir "%CommonStartMenu%\%menu%" pushd "%StartMenu%\%menu%" for %%F in ("Dropbox.lnk" "Dropbox Website.url") do ( copy /y "%%~F" "%CommonStartMenu%\%menu%" del "%%~F" ) popd