Skip to content

Instantly share code, notes, and snippets.

@faizul726
Last active September 28, 2025 17:11
Show Gist options
  • Select an option

  • Save faizul726/7853898d6e3448b754864753e330dc57 to your computer and use it in GitHub Desktop.

Select an option

Save faizul726/7853898d6e3448b754864753e330dc57 to your computer and use it in GitHub Desktop.
Creates start menu entry for files that can't be pinned to taskbar. May or may not work ¯\_ (ツ)_/¯ (PowerShell required). Use by dragging the target file on top of the script.
:: Thanks to https://medium.com/@dbilanoski/how-to-tuesdays-shortcuts-with-powershell-how-to-make-customize-and-point-them-to-places-1ee528af2763
@echo off
setlocal
if "[%1]" equ "[]" (
echo [^!] Target file not specified.
echo.
echo Click any key to exit...
pause >nul
exit /b 1
) else (
echo [?] Create shortcut for "%1"?
echo Close the window if you don't want to, else press any key to start
echo.
pause
)
pushd "%~dp0"
set "shortcutFile=%APPDATA%\Microsoft\Windows\Start Menu\Programs\%~n1.lnk"
powershell -Command ^
$ws = New-Object -ComObject WScript.Shell; ^
$s = $ws.CreateShortcut('%shortcutFile%'); ^
$s.TargetPath = '%1'; ^
$s.Save()
echo [*] Shortcut created in "%shortcutFile%"
echo.
echo Click any key to exit...
pause >nul
exit /b 0
rem unused: $s.IconLocation = \"%cd%\.settings\matject_icon.ico\"; ^
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment