How to Pin a Batch File to the Windows Taskbar

windows won’t let you pin .bat files directly to the taskbar – dragging one there or right-clicking and selecting “Pin to taskbar” doesn’t work. here’s the workaround.

Why batch files can’t be pinned directly

Windows only allows .exe files (executables) to be pinned to the taskbar. Batch files (.bat) are script files that run through cmd.exe. Since the taskbar can’t pin a script directly, you need to create a shortcut that points to cmd.exe with your batch file as an argument.

Method 1: Create a shortcut to cmd.exe running the batch file

  1. Right-click the desktop > New > Shortcut
  2. In the location field, enter:
    cmd.exe /c "C:/path/to/your/batchfile.bat"
    Replace the path with the actual path to your .bat file
  3. Name the shortcut whatever you want
  4. Right-click the new shortcut > Pin to taskbar

The shortcut appears on the taskbar and runs your batch file when clicked.

If you want it to run minimized (no Command Prompt window visible):
Right-click the shortcut > Properties > Shortcut tab > Run: change to “Minimized”

Method 2: Change the shortcut to run with cmd /k (keeps window open)

If you want to see the batch file’s output, use /k instead of /c:
cmd.exe /k "C:/path/to/your/batchfile.bat"

/c runs the command and closes the window. /k runs the command and keeps the window open.

Method 3: Change the shortcut’s icon

The default shortcut icon will be the cmd.exe icon. To change it:

  1. Right-click the shortcut > Properties > Shortcut tab > Change Icon
  2. Browse to an .ico file or another .exe with icons you want to use

Running as administrator

If your batch file requires admin privileges, right-click the shortcut > Properties > Shortcut tab > Advanced > check “Run as administrator.” The shortcut will prompt for UAC elevation when clicked.

The run as administrator shortcut property being needed for system-level batch files is important. Scripts that modify registry values, restart services, or access protected paths need elevation. Setting it at the shortcut level means you don’t have to remember to right-click and run as admin each time.