Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.