Skip to content

Instantly share code, notes, and snippets.

@bentodaniel
Created June 7, 2021 15:04
Show Gist options
  • Save bentodaniel/f11442586cefc68a0bb4fc8f81679f82 to your computer and use it in GitHub Desktop.
Save bentodaniel/f11442586cefc68a0bb4fc8f81679f82 to your computer and use it in GitHub Desktop.
Script to quickly set up or get all bookmarks from google chrome
:: This script gets or sets the bookmarks from browser
@echo off
cls
set $bookmark_location="%LOCALAPPDATA%\Google\Chrome\User Data\Default\Bookmarks"
set mypath=%cd%
:choice
set /P c=Get/Set browser bookmarks [Y/N]?
if /I "%c%" EQU "Y" goto :browser_info
if /I "%c%" EQU "N" goto :exit
:browser_info
echo.
echo Warning this script uses by default Google Chrome
echo.
echo You have 10 seconds to answer. Default is No.
choice /c YN /n /t 10 /d N /m "Do you want to change the browser [Y/N]? "
if errorlevel 2 goto :start_execution
if errorlevel 1 goto :change_browser
:: Allows the user to change the browser used
:change_browser
echo.
set /p $bookmark_location=Insert location of browser bookmarks:
:: Starts execution
:start_execution
echo.
echo You have 10 seconds to answer. Default is Set.
choice /c SG /n /t 10 /d S /m "Do you want to [S]et or [G]et bookmarks [S/G]? "
if errorlevel 2 goto :get_bookmarks
if errorlevel 1 goto :set_bookmarks
:: Sets the bookmarks into the browser
:set_bookmarks
echo.
choice /c YN /n /t 10 /d N /m "Do you want to change file location? Default is %mypath%\Bookmarks [Y/N]? "
if errorlevel 2 goto :set_bookmarks_action
if errorlevel 1 goto :change_path
:change_path
echo.
set /p mypath=Enter the bookmarks file path:
:: Copies the bookmarks file to the browser dir
:set_bookmarks_action
echo.
echo Setting bookmarks...
echo.
copy %mypath%\Bookmarks %$bookmark_location%
echo Bookmarks have been saved to %$bookmark_location%
goto :exit
:: Gets the bookmarks from browser
:get_bookmarks
echo.
echo Getting bookmarks...
echo.
copy %$bookmark_location% Bookmarks
set mypath=%cd%
echo Bookmarks have been saved to %mypath%\Bookmarks
goto :exit
:: Stops execution of the script
:exit
echo.
echo Exiting...
goto :eof
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment