1

How do you get a file opened by a batch file pinned to the taskbar?

In XP you could just drag your batch file onto the quicklaunch section of the taskbar, then any file you drop on that icon would be opened with that batch file.

In windows 7 you can get a batch file there using various methods, and you can open a file with a pinned application by shift dragging onto it, but this doesn't work for batch files.

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

4
  • What?! I am on XP.. I've no idea what you mean. Give an example of what would be in the bat file, and what file or what would be in te file that you would drag onto it. I can drag a txt file onto a batch file icon in the quicklaunch toolbar but that txt file is not opening when I do that.
    – barlop
    Commented Mar 27, 2012 at 5:37
  • i.imgur.com/KaQfZ.png
    – daniel
    Commented Mar 27, 2012 at 22:52
  • What you mean is pass a file(filename actually) as a parameter to a batch file. That is absolutely not, opening it. For example, the file could have anything or nothing in it, and it could be called trad.a the batch file could say echo %* new line pause When you drag the file onto the icon for the batch file in the quicklaunch toolbar, then the batch file opens says echo trad.a and displays the text trad.a on the screen. The file trad.a was not opened before during or after.
    – barlop
    Commented Mar 28, 2012 at 2:38
  • Its more like passing the the filepath as %1, but whatever you are right I don't open it, in my batch I copy it to somewhere. The wording is wrong on win 7, so I guess we should be taking it up with microsoft. I'm still annoyed that shift dragging onto pinned applications does work, but onto pinned bats it just quietly fails.
    – daniel
    Commented Mar 28, 2012 at 6:06

1 Answer 1

3

I don't know about pinned items, but you may be able to have the same effect with toolbars on the task bar

1) Set up your batch file in a folder. Call it what you want, for my example, my folder is called Batch Files and my batch script is called test (all it does is open cmd.exe at the moment)

2) Right Click on the taskbar, select Toolbars->Add toobar

3) Navigate to the Batch Files folder and hit 'Select Folder'

4) Unlock your taskbar (right click, unlock taskbar) and drag the toolbar to where you want it.

(NOTE: Whilst here, you can also right click the drag-area on the toolbar and change some settings like whether to display folder name, file names etc)

5) Try dopping a file onto the test batch file. The batch file should run (and displays cmd.exe in my case)

Hope this helps

PS: you can have nested folders/files as well, in case you want to have links to different things.

PPS: I usually create the folder in the root C:\ directory, but again you can create it anywhere

EDIT: This walkthrough has pictures as well, just scroll down to 'Creating a Toobar' section:

http://www.homeandlearn.co.uk/bc/win7/toolbars.html

1
  • This works, I was looking at this method but I didn't like that it had to be a folder, and not a file, but I can re write my batch script and have the file sit in its own little folder now. It feels like a work around and isn't pretty, but hey we are working in an imperfect world.
    – daniel
    Commented Mar 27, 2012 at 6:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .