Advertisement
J2897

Reset LibreOffice

Jan 9th, 2015
418
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 1.18 KB | None | 0 0
  1. @echo OFF
  2. setlocal
  3.  
  4. REM This will reset LibreOffice back to the default settings.
  5. REM Create a shortcut to this Batch file and put it here...
  6. REM "%APPDATA%\Microsoft\Windows\Start Menu\Programs"
  7. REM It will now appear in your Start Menu.
  8.  
  9. REM Kill LibreOffice.
  10. taskkill /im "soffice.bin" /f 2>nul
  11.  
  12. REM Set the LibreOffice Folder.
  13. set "LOF=%APPDATA%\LibreOffice"
  14.  
  15. REM Try to remove that folder.
  16. if exist "%LOF%" (
  17.     :: http://ss64.com/nt/rd.html
  18.     rd /s /q "%LOF%" || echo Couldn't remove the LibreOffice folder. && goto :End
  19. ) else (
  20.     echo Folder not found.
  21.     goto :End
  22. )
  23.  
  24. REM Get the full Program Files path.
  25. set /A COUNT=0
  26. call :Subroutine
  27.  
  28. REM Verify the removal.
  29. if exist "%LOF%" (
  30.     echo Could not delete: %LOF%
  31. ) else (
  32.     echo Deleted: %LOF%
  33.     echo Starting LibreOffice . . .
  34.     start "" /D "%PROGRAMFILES%\LibreOffice %COUNT%" "%PROGRAMFILES%\LibreOffice %COUNT%\program\soffice.exe" && echo Done.
  35. )
  36.  
  37. :End
  38. endlocal
  39. echo Ending . . .
  40. timeout /t 15 /nobreak >nul
  41. exit 0
  42.  
  43. :Subroutine
  44. if exist "%PROGRAMFILES%\LibreOffice %COUNT%" (
  45.     exit /b 0
  46. )
  47. set /A COUNT=COUNT+1
  48. if %COUNT% EQU 50 (
  49.     echo The LibreOffice path name has changed.
  50.     goto :End
  51. )
  52. goto :Subroutine
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement