Skip to content

Instantly share code, notes, and snippets.

@joshuatz
Created May 11, 2019 23:58
Show Gist options
  • Save joshuatz/b8725f9933c9ba5d8b88da773bd07080 to your computer and use it in GitHub Desktop.
Save joshuatz/b8725f9933c9ba5d8b88da773bd07080 to your computer and use it in GitHub Desktop.
Restart the Dropbox client by running a Windows Batch Script. Searches in both Program Files directories for exe to start back up.
@echo off
cls
REM # Find and kill the dropbox process
taskkill /FI "IMAGENAME eq Dropbox.exe" /F
REM # Wait a little
@echo on
cls
echo "Please wait while restarting Dropbox"
@echo off
SLEEP 5
REM # Start back up - scan for Dropbox.exe file
SET Dropbox64Path="%programfiles%\Dropbox\Client\Dropbox.exe"
SET Dropbox86Path="%programfiles(x86)%\Dropbox\Client\Dropbox.exe"
SET FOUND=0
IF EXIST %Dropbox64Path% (
echo "found 64"
start "" %Dropbox64Path%
SET FOUND=1
) ELSE IF EXIST %Dropbox86Path% (
echo "found 86"
start "" %Dropbox86Path%
SET FOUND=1
) ELSE (
echo "could not find dropbox.exe!"
)
REM # Line breaks
ECHO,
ECHO,
IF %FOUND% EQU 1 (
@echo on
cls
echo "Successfully restarted Dropbox.exe"
) ELSE (
@echo on
cls
echo "Could not restart Dropbox.exe - could not find executable!"
)
PAUSE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment