How to pin either a Shortcut or a Batch file to the new Windows 7, 8 and 10 Taskbar and start menu?

276

74

We are having trouble adding our batch scripts to the Windows 7, 8 or 10 taskbar or start menu.

Our batchfiles take some arguments and just execute other application based on those arguments . To keep it simple, we created some shortcuts for our customers which they just need to click in order to get everything running.

The question here is: How can we pin those shortcuts or batch files to the taskbar or start menu?

(The customers aren't supposed to access the file system and that's why they can only see the taskbar)

Shaharyar

Posted 2010-01-25T10:16:02.540

Reputation: 3 101

Answers

376

  1. Create a shortcut to your batch file.
  2. Get into shortcut property and change target to something like: cmd.exe /C "path-to-your-batch".
  3. Simply drag your new shortcut to the taskbar. It should now be pinnable.

Kamil Klimek

Posted 2010-01-25T10:16:02.540

Reputation: 3 929

1Although this 'seems' to work but the behavior isn't quite the same. 'Standard' pinned program will be active (selected) once it is clicked so when you click it again later it will bring the program to the front. But with pinned shortcuts, it will start a new process/window every time you click it. So it is not quite the expected behavior. – Rosdi – 2015-03-03T04:13:18.613

1What does /C in cmd.exe /C "path-to-your-batch" exactly mean? – Daniel Krizian – 2015-04-07T12:36:38.013

/C is command i gues - shortcut launches batch and executes command after /C in it – Kamil Klimek – 2015-04-08T13:01:13.557

1

@Daniel check http://stackoverflow.com/a/515316/146513

– Mariano Desanze – 2015-12-08T06:47:35.840

Not working if you have spaces in "path-to-your-batch" even if it's quoted, so be aware of it – ABCplus – 2017-05-17T10:05:49.317

I tried this for a .cmd file (e.g. my.cmd) and it doesn't work for me. I ensured there was no spaces in my path, but still can't pin it. Can I pin .cmd files? – sdoca – 2017-08-21T20:39:46.503

The answer from apple16 to prevent a cmd window to pop up also fixes the problem induced by the original solution : when cmd windows are opened, they share the same icon than the one of the pinned shortcut, which was even more annoying for me. – Manuel Rozier – 2017-11-24T13:22:13.043

help cmd say: /C Carries out the command specified by string and then terminates – Alejandro Blasco – 2018-03-12T19:38:25.180

This solution works properly for me, but if you want to remain the cmd open you should use /k instead of /c – Balder – 2018-07-16T11:02:20.883

6Such a simple solution. Strange that pinning of direct shortcuts to batch files is not supported. – Steve Crane – 2011-02-07T08:16:35.727

Unfortunately if you have multiple batch files to pin, they don't stack similar to how explorer pins work. – Jeff Mercado – 2012-05-25T18:52:50.633

17And if your annoyed that a cmd window pops up every time you use the shortcut, after pinning, you can open the shortcut at C:\Users\<User name>\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar and change the target path back to path-to-your-batch – apple16 – 2012-11-01T22:53:25.117

Added SU to my network just to give KamilKlimek my upvote on his answer. Thanks also to @apple16. – None – 2012-12-07T22:19:05.043

11The names and icons stick after you pin the item, so it is good to also perform step 2.5: Change the name and icon of the shortcut. – JohnEye – 2013-04-05T13:49:49.393

50

This thread nearly answers my problem, another thread worth reading that solves these issues in a different way is here:Adding Batch Files to Windows 7 Taskbar like the Vista/XP Quick Launch

I was able to add a batchfile to the taskbar by the following steps:

  1. Renaming your .cmd/.bat to to .exe
  2. Right clicking on the *.exe and choose pin to taskbar
  3. Renaming it back to .cmd/.bat
  4. Shift+right clicking the taskbar icon (for the exe) and choose properties
  5. Changing the reference from *.exe to .cmd/.bat and change icon as needed

It starts working right away but the icon refresh needs a reboot.

I have an additional question though: how do you get a pinned taskbar batch file accepting another file as a parameter? It works when pinned onto the startbar, or just in the folder, but I can't get it working like it did on XP.

This is the functionality I'm talking about:

Drag and drop a file on the bat icon. The bat will receive the file name of the dropped file as %1 and vbscript will receive it as WScript.Arguments(0).

daniel

Posted 2010-01-25T10:16:02.540

Reputation: 673

2I'd be happy if i weren't crying about why this is appearantly still necessary. Thanks, @daniel. appearantly this is still true for win8/10 – Timothy Groote – 2016-03-02T10:23:35.797

this works in Win10 as well :)! – J-Dizzle – 2016-08-23T22:53:30.257

Dang, doesn't work for me. Everything did except for when I shift right-click; there's no Properties for the shortcut (I looked under the "More" menu too). Right-click (without shift) is the same. Dangit. Without that last step it's still pointing to the .exe. file. – clamum – 2018-02-19T21:08:26.280

Tip: If you think to change the *.ico associated with shortcut, do it before drag it. And like says Timothy Groote, I wonder why this whole procedure is necessary, for something so simple :'( – Lucas – 2018-03-28T12:51:17.540

1@clamum If you click on "Open File Location" under the "More" menu it'll take you to where the shortcut is. Then you can right-click on the shortcut file to change the target (H/T to the answer by @iuliu.net) – Jeff B – 2018-10-01T16:31:17.183

Thanks for the comment, Jeff. Strangely enough, I just retried doing the steps and it worked perfectly. I should note that I'm running Win7 right now; back in February I think I was on Win10. I see the thread says it's for 7/8/10, but I believe that's the reason for the difference, in my case. – clamum – 2018-10-11T14:31:13.167

5+1 No need to have a separate shortcut to the batch. And you don't actually need to reboot, you can just kill off explorer.exe and re-run it from task manager for the icon to refresh. – stylez – 2012-09-29T16:53:31.987

15

The folder for the Windows 7 taskbar is located at:

C:\Users\%USERNAME%\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar

The Start Menu folder is:

C:\Users\%USERNAME%\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned\StartMenu

You can create a shortcut there and upon logging off and back on, it should appear.

Hope this helps.... There are other things I should caution you about, for example, they can right click and edit the batch file - so, you may want to look at NTFS permissions for locking down the file.

William Hilsum

Posted 2010-01-25T10:16:02.540

Reputation: 111 572

3This approach didn't work with shortcuts.. – Shaharyar – 2010-01-25T12:36:21.707

Also tried adding a new shortcut here, and it did not show up in the taskbar after restarting explorer.exe. – eidylon – 2010-05-24T14:38:29.430

I used @daniel's solution to add the shortcut and yours to change the icons. Did require an explorer restart to see the new icons. – Anthony Horne – 2018-07-30T09:49:05.077

3

Yes this is an annoying "feature" of the windows 7 taskbar. I built a simple application that runs batch files which you can pin to your taskbar and pin batch files to it. It gets the job done. Download it for free -> http://johnastevens.com/helpTopics.aspx#batchapp

John Stevens

Posted 2010-01-25T10:16:02.540

Reputation: 31

The link now leads to a domain parking page. – devtk – 2018-03-28T14:20:24.107

1Works like a charm. The only thing missing is that when you just click RunBatch it does nothing, it would be nice if it opens the command prompt. – Jochen – 2011-01-05T14:35:43.057

1Thanks for taking the effort to write and make this available but it seems a bit of an over the top approach when the solution given by Kamil Klimek is so simple. – Steve Crane – 2011-02-07T08:15:13.853

2

I will add another useful method.. In Windows 10, do you want to have simpler Taskbar, where you can pin things easily (small icons) like this?:

enter image description here

so you will see only those programs that are opened.

In "Documents", create a folder, named "my icons", and put there desired shortcuts. Then right click on taskbar -->"New toolbar":

enter image description here

and select your folder. Then unlock taskbar, right click on the new toolbar, and uncheck "Show Title" and "Show Text":

enter image description here

p.s. dont forget to uncheck "NEVER COMBINE ICONS" in taskbar properties:

enter image description here

T.Todua

Posted 2010-01-25T10:16:02.540

Reputation: 2 436

Works on Windows 8.1 as well – rxantos – 2018-01-14T04:21:06.903

1

In my case, none of these solutions got it to 100%. They were close, but on the latest windows 10 these are the steps that I had to follow:

1. Rename .bat to .exe
2. Right click .exe => Pin To Start
3. Right click .exe => Rename to .bat
4. Right click taskbar/start menu item => More => Open File Location
5. Right click the shortcut => Change target from .exe to .bat

Done!

iuliu.net

Posted 2010-01-25T10:16:02.540

Reputation: 131

This does not work for me, I'm getting a This app can't run on your PC message. Windows 10 V1703 Build15063.332 – jay – 2017-05-30T06:01:10.027