Last active
October 3, 2021 12:33
-
-
Save Techlogist/6cb99db848e8851cb42204e3aa05f675 to your computer and use it in GitHub Desktop.
Copy all Chrome favourites with a Batch script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
REM License: GNU General Public License v2.0 | |
REM Author: Miguel | |
REM Website: www.techlogist.net | |
REM Post: https://techlogist.net/batch/copy-all-chrome-favourites-with-a-batch-script/ | |
REM Description: This script helps users to migrate their Chrome bookmarks in Windows 10 | |
REM OS/Language/Region: Windows/EN-US | |
REM Start of script | |
:_start | |
@echo off | |
title Copy all user and favourites settings from Chrome | |
color f0 | |
mode con:cols=70 lines=10 | |
goto _run | |
:_run | |
cls | |
REM Set locations as variables | |
set _Chrome_Bookmarks=C:\Users\%username%\AppData\Local\Google\Chrome\User Data\Default | |
set _Destination_Folder=C:\Users\%username%\Downloads\Chrome-Bookmarks-%username% | |
goto create-folder | |
REM We need to check if the destination folder exists the target folder | |
:create-folder | |
cls | |
if exist "%_Destination_Folder%" goto _delete_folder else goto _create_folder | |
REM Delete the destination folder if it exists | |
:_delete_folder | |
DEL /F/Q/S "%_Destination_Folder%" > NUL | |
RMDIR /Q/S "%_Destination_Folder%" | |
goto _create_folder | |
REM Create the destination folder | |
:_create_folder | |
cls | |
mkdir "%_Destination_Folder%" | |
goto _copy_bookmarks | |
REM Copy the bookmarks | |
:_copy_bookmarks | |
copy /Y "%_Chrome_Bookmarks%\Bookmarks" "%_Destination_Folder%" | |
copy /Y "%_Chrome_Bookmarks%\Bookmarks.bak" "%_Destination_Folder%" | |
start explorer.exe "%_Destination_Folder%" | |
goto _create_install_bat | |
:_create_install_bat | |
cls | |
echo set _current_folder=%%CD%% >%_Destination_Folder%\Run_At_Client.txt | |
echo cd %%_current_folder%% | |
echo copy /Y "bookmarks" "C:\Users\%%username%%\AppData\Local\Google\Chrome\User Data\Default" >>%_Destination_Folder%\Run_At_Client.txt | |
echo copy /Y "bookmarks.bak" "C:\Users\%%username%%\AppData\Local\Google\Chrome\User Data\Default" >>%_Destination_Folder%\Run_At_Client.txt | |
echo chrome.exe >>%_Destination_Folder%\Run_At_Client.txt | |
cd %_Destination_Folder% | |
ren *.txt *.bat | |
goto EOF | |
:EOF | |
cls | |
exit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment