Skip to content

Instantly share code, notes, and snippets.

@Techlogist
Last active October 3, 2021 12:34
Show Gist options
  • Save Techlogist/273c2989150077ce2a3aedb679eca313 to your computer and use it in GitHub Desktop.
Save Techlogist/273c2989150077ce2a3aedb679eca313 to your computer and use it in GitHub Desktop.
Copy all the items pinned in the taskbar of Windows 10
REM License: GNU General Public License v2.0
REM Author: Miguel
REM Website: www.techlogist.net
REM Post: https://techlogist.net/batch/copy-all-the-items-pinned-in-the-taskbar-of-windows-10
REM Description: This script copies the pinned shortcuts in your W10 task bar if ran as Administrator
REM OS/Language/Region: Windows/EN-US
@echo off
title Copy
color f0
mode con:cols=70 lines=10
goto start
:start
REM Define File Paths
set _Taskbar_Pinned=C:\Users\%username%\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar
set _Destination_Folder=C:\Users\%username%\Downloads\W10-%username%-Taskbar
REM Check if folder exists
cls
if exist "%_Destination_Folder%" goto _delete_folder else goto _create_folder
REM Create the destination folder
:_delete_folder
REM Delete the destination folder if it exists
DEL /F/Q/S "%_Destination_Folder%" > NUL
RMDIR /Q/S "%_Destination_Folder%"
goto _create_folder
:_create_folder
REM Create the destination folder
cls
mkdir "%_Destination_Folder%"
goto _copy_w10_pinned
:_copy_w10_pinned
REM Copy the pinned items
cd %_Taskbar_Pinned%
xcopy * %_Destination_Folder% /E /C /H /R /K /Y
REM Copy registry key. IMPORTANT!!!
cd "%_Destination_Folder%"
REG EXPORT HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Taskband W10TaskbarCopyTemp.reg /Y
Ren "W10TaskbarCopyTemp.reg" "W10-%username%-Taskbar.reg"
REM Check
start explorer.exe %_Destination_Folder%
goto _create_bat
:_create_bat
cls
echo REM Run this as Administrator >%_Destination_Folder%\Run_As_Admin_At_Client.txt
echo set _current_folder=%%CD%%>>%_Destination_Folder%\Run_As_Admin_At_Client.txt
echo cd %%_current_folder%%>>%_Destination_Folder%\Run_As_Admin_At_Client.txt
echo REGEDIT /S “%%_current_folder%%\W10-%username%-Taskbar.reg">>%_Destination_Folder%\Run_As_Admin_At_Client.txt
echo xcopy * "C:\Users\%%username%%\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar" /E /C /H /R /K /Y >>%_Destination_Folder%\Run_As_Admin_At_Client.txt
echo del "C:\Users\%%username%%\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar\Run_As_Admin_At_Client.bat" /q >>%_Destination_Folder%\Run_As_Admin_At_Client.txt
echo exit >>%_Destination_Folder%\Run_As_Admin_At_Client.txt
cd %_Destination_Folder%
ren *.txt *.bat
goto exit
:exit
exit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment