Sadly this doesn't appear to work and I'm curious as to why not.
Whenever you attempt to pin (at least some) scripts (e.g. VBS, Python) to the taskbar, a pin for the interpreter is created instead. This applies to pinning any shortcut for these types of scripts as well.
Windows appears to do this under the assumption that you may wish to run multiple scripts from the same pin (i.e. if you pin a script directly to the taskbar, a pin to the interpreter is created [as noted], but the script itself is shown under the "Recent" or "Pinned" lists if you immediately right-click the pinned item).
I would appreciate some assistance in troubleshooting this.
In order to make things work as you intend, you need to edit the target of the pinned shortcut by:
Right-clicking the pinned item.
Selecting the interpreter entry and right-clicking again.
Choosing Properties and editing the Target field in the Shortcut tab.
In your case, you should change the Target from e.g.:
Make sure to click Apply after changing the Target. Press Ok to close the window when finished.
Simply appending the full path of the script (in quotes) to the interpreter entry should be sufficient to run most scripts. That said, some interpreters may require additional command switches to run a script properly.
For batch files (
.bat), Windows apparently doesn't allow scripts or shortcuts to scripts to be pinned directly. You must pin e.g.
%SystemRoot%\system32\cmd.exe) first, then edit the pin as mentioned above. The final Target should look like:
C:\windows\system32\cmd.exe /c "c:\path\to\your\script.bat"
cmd.exe that it should only run the command listed and then immediately close itself.
If you are still having trouble, there may be another problem (such as window focus). As is, the
.vbs script itself seems to work (it sends Ctrl + J without issue).