Skip to content

Instantly share code, notes, and snippets.

@evantoli
Last active January 21, 2016 22:10
Show Gist options
  • Save evantoli/6d2a1bb26f1a93bd2743 to your computer and use it in GitHub Desktop.
Save evantoli/6d2a1bb26f1a93bd2743 to your computer and use it in GitHub Desktop.
Recreate Windows Favorites Shortcuts
REM I created a variation of this script because after years of working exclusively in the
REM in the Linux/Unix world I had to suddenly remote into six separate Windows Servers
REM which had no real, usable, shell. Not even powershell. Everything was done via many sluggish
REM mouse clicks on several open windows (themselves within the open remote desktop windows).
REM I was going mental navigating via the explorer window so wanted to be able to create
REM and re-create some shortcuts on all the environments.
del /Q %USERPROFILE%\Links\*.lnk
call:createFavouritesShortcut "E:\Apps" "E - Apps"
call:createFavouritesShortcut "E:\Apps\SomeApplication" "E - Apps - SomeApplication"
call:createFavouritesShortcut "E:\Apps\AnotherApplication" "E - Apps - AnotherApplication"
call:createFavouritesShortcut "F:\Logs" "F - Logs.lnk"
call:createFavouritesShortcut "F:\Logs\SomeApplication" "F - Logs - SomeApplication.lnk"
call:createFavouritesShortcut "F:\Logs\AnotherApplication" "F - Logs - AnotherApplication.lnk"
goto:eof
REM This subroutine requires Shortcut.exe, downloadable from
REM http://www.optimumx.com/download/Shortcut.zip,
REM to be in a relative Shortcut directory.
:createFavouritesShortcut
IF EXIST "%~1" (
start "" /D .\Shortcut Shortcut.exe /f:"%USERPROFILE%\Links\%~2" /a:c /t:"%~1"
)
goto:eof
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment