Pin a batch file to the Start menu or taskbar in Windows 10

Sometimes you need to pin a batch file to the Start menu or taskbar in Windows. Unfortunately, the operating system doesn't allow you to do it out of the box. "Pin to Start" and "Pin to taskbar" context menu commands are missing in the context menu of File Explorer in Windows 10. Here is a quick workaround which will allow you to achieve the goal.

When you right click a batch file, you will see that the context menu does not contain the commands "Pin to Start" and "Pin to taskbar":
no pin context menu
As a workaround, you can create a shortcut with the following target:

cmd /c "path to your batch file"

This will execute the batch file and close the command prompt window. Double quotes are so that you can use long file names in the path.
If you use the following shortcut target:

cmd /k "path to your batch file"

Then the command prompt will remain open after the batch file finishes running.
When you right click such a shortcut, it will include the context menu commands to pin to Taskbar or Start!

Here is what you need to do.

  1. Right click on the Desktop and select the command "New -> Shortcut" from the context menu.Windows 10 new shortcut
  2. In the shortcut target, type the following text:
    cmd /c "full path to your batch file"

    In my example, it will be

    cmd /c "C:\Users\winaero\Desktop\test.cmd"

    shortcut target

  3. Name the shortcut and change its icon if you need:shortcut name
  4. Now, right click the shortcut and choose "Pin to Start" from the context menu:Windows 10 pin batch file to start

You are done. The result will be as follows:Windows 10 pinned batch file to start Windows 10 pinned batch file to start 2

That's it.

Support us

Winaero greatly relies on your support. You can help the site keep bringing you interesting and useful content and software by using these options:

31 thoughts on “Pin a batch file to the Start menu or taskbar in Windows 10

  1. Bert McLees

    hmmm… still don’t get the option of pinning to start.. bat file works fine… ideas?

    Reply
    1. Sergey Tkachenko Post author

      Follow the instruction carefully. You shortcut should point to the cmd.exe file.

      Reply
    2. ruben

      Once you have the shortcut on your desktop, you can drag it to the taskbar.

      Reply
  2. Jeffrey Bue

    I tried this multiple times and {sigh} I can’t get it to work. The short cut gets created, but when I double-click it, the batch files doesn’t run… no errors… just doesn’t run.

    Reply
    1. Gabriel

      Try
      cmd /c “[path to batch].bat”
      instead of
      cmd /c “[path to batch].cmd”
      It worked for me.

      Reply
    2. Padraic

      Don’t use a .bat file – type the command straight into the shortcut.

      Reply
      1. James

        I did the same and worked for me

        Reply
  3. Michael Wonderland

    Fast Easy solution: Rename your .bat file to .exe and then drag to task bar. Then right click the shortcut on the taskbar, select properties, and rename back to .bat .. and rename the original file back to .bat

    Reply
    1. Adrian

      I can confirm that this works, however it should be noted that you need to Shift+right click and not just right click.

      Reply
      1. wowereit

        Works very well thanks!

        Reply
    2. Username

      Michael Wonderland’s solution better – it allow to ping multiple bat or bat and command line in same time.
      Solution from the article dont allow to pin Command line shurtcut and .bat (because cmd.exe executable in both shortcuts).

      Reply
    3. Roxann Higuera

      This method worked for me. If you want to put the link on Start, right click the .exe and click Pin to Start. Then, from Start, right click on the resulting button. Select “Open file location.” Right click on the file in the file explorer to get to properties.

      Reply
    4. theofficalbanana

      the only thing is that the icon does not change back to a bat file icon it stays looking like an .exe file

      Reply
  4. Gustavo

    The bat file is not necessary. You can write the command directly in the “Type the location of the file” box of the shortcut creation wizard.
    Anyway, that is not enough. Right-clicking on the new shortcut still does NOT show the “pin to start menu” menú item. For that to happen you also have to:
    1) Move the shortcut to a subfolder of the “start menu” folder, which is located in “%USERPROFILE%\AppData\Roaming\Microsoft\Windows\Start Menu”.
    2) Use the search box in the taskbar to find the shortcut
    Then, right-clicking on on the search result should show the “pin to start menu” item.

    Reply
    1. James

      Thanks. Worked like a dream!

      Reply
    2. Marcel Kincaid

      “The bat file is not necessary.”

      That’s nonsensical. This article is about how to pin a batch file.

      “You can write the command directly in the “Type the location of the file” box of the shortcut creation wizard.”

      What command? Again, this article is about how to pin a *batch file*. If you put the batch file location directly into the location, you can’t pin the shortcut … the whole point is that you need a .exe … cmd.exe for executing batch files.

      Reply
  5. Fear

    The most easy solution.
    Copy de direct acces to : C:\Users\[YOURUSER]\AppData\Roaming\Microsoft\Windows\Start Menu\Programs

    Then, you will see the .bat in the windows menu, right click and “pin to start menu” :)

    Reply
    1. Chris

      Not seeing any .bat file in there!

      Reply
  6. Marcel Kincaid

    Thanks for this. Nowhere else mentions using cmd.exe, and most of the comments above are wrong, except the one about dragging the shortcut to the taskbar, which I needed because my shortcut doesn’t have “Pin to taskbar” in the context menu for some reason.

    Reply
  7. Chris

    It fails for me as well. There is a DOS window that flashes momentarily, but that’s about it.

    Reply
  8. Alex

    Thank you so much!

    Reply
  9. Pingback: 5 Windows display tricks to help you focus - Gigarefurb Refurbished Laptops News

  10. Pingback: 5 Windows display tricks to help you focus - Daily News Observer

  11. Pingback: 5 Windows display tricks to help you focus – Persian Version

  12. Pingback: 5 Windows display tricks to help you focus – MNNOFA NEWS

  13. Pingback: 5 Windows display tricks to help you focus - TECH INSPIRED NEWS

  14. Anon

    Just change the file extension to .exe, drag it to task bar, change it back to .bat file. after that, shift + right click the file on the task bar, properties, and change the .exe to .bat

    Reply
  15. Gary Gemmell

    Brilliant been looking for a workaround for this for ages!

    Reply
  16. Me

    Thx a lot. I had to make a batch file solution to hibernate my pc ‘manually’ and was able to put the shortcut on the taskbar thanks to your suggestion.

    ::Run at elevated prompt
    @echo off
    if _%1_==_payload_ goto :payload

    :getadmin
    echo %~nx0: elevating self
    set vbs=%temp%\getadmin.vbs
    echo Set UAC = CreateObject^(“Shell.Application”^) >> “%vbs%”
    echo UAC.ShellExecute “%~s0”, “payload %~sdp0 %*”, “”, “runas”, 1 >> “%vbs%”
    “%temp%\getadmin.vbs”
    del “%temp%\getadmin.vbs”
    goto :eof

    :payload

    ::ENTER YOUR CODE BELOW::

    @echo OFF

    shutdown /h

    Reply
  17. PureOcean

    I prepared the following BAT script for the Send To context menu. This BAT file copies itself to the Send To folder, thus creating any file to click in the Send To context menu as a shortcut to the Start Menu\Programs.

    @echo off

    :: Pin To Start (Limitless) for the “Send To” context menu (by PureOcean, 2021-06-12)
    :: This BAT file copies itself to the SendTo folder, thus creating any file to click in the Send To context menu as a shortcut to the Start Menu\Programs. Even .BAT/.CMD files that Windows doesn’t support (That’s why it was prepared).

    IF EXIST “%USERPROFILE%\AppData\Roaming\Microsoft\Windows\SendTo\%~nx0” (GOTO :PinToStart) ELSE (Copy “%~nx0” “%USERPROFILE%\AppData\Roaming\Microsoft\Windows\SendTo\%~nx0” /y > nul && Echo %~nx0 added to the “Send To” context menu. && pause > nul && exit /b)

    :PinToStart
    powershell “$s=(New-Object -COM WScript.Shell).CreateShortcut(‘%USERPROFILE%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\%~n1.lnk’);$s.TargetPath=’%~f1′;$s.WorkingDirectory=’%cd%’;$s.Save()”

    Reply
  18. Carlso James

    Follow my original method, and you will get .bat file{s} pinned in Taskbar. WORKS 100%

    Step 1: Create shortcut of your .bat file (for example in Desktop “C:\Users\youruser\Desktop\yourfile.bat”). So you will end up with “yourfile.bat – Shortcut.lnk” (you might not see extension “.lnk”).

    Step 2: Right Click your shortcut and change your Target field from: “C:\Users\youruser\Desktop\yourfile.bat” to: explorer “C:\Users\youruser\Desktop\yourfile.bat” – note: explorer is the explorer.exe app. You can also write the full Path: C:\Windows\explorer.exe, for no confusion.

    Step 3: Now Right Click your shortcut and now you can see the option Pin to Taskbar.

    Step 4: Right Click the pinned shortcut, and you will see two options: shortcut itself and unpin option. Right Click the shortcut and select Properties. From Target field delete “C:\Windows\explorer.exe” and leave only “C:\Users\youruser\Desktop\yourfile.bat”, and click OK

    Now you can delete your shortcut in Desktop, since now you have your standalone shortcut on Taskbar
    Optionaly, if you want to change Icon do Step 4, but now click “Change Icon…” button, and choose your custom Icon, from some other exe file or .ico file.

    That’s it!
    Now you have fully functional batch file shortcut on Taskbar

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *