Pin programs via script or un pin

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Message
Author
Krump
Posts: 45
Joined: 02 Dec 2014 14:53

Re: Pin programs via script or un pin

#16 Post by Krump » 18 Feb 2015 01:13

So any ideas?

penpen
Expert
Posts: 1864
Joined: 23 Jun 2013 06:15
Location: Germany

Re: Pin programs via script or un pin

#17 Post by penpen » 02 Mar 2015 13:23

Krump wrote:But how Pin windows explorer?
You may try one of these solutions (hopefully one off these works):
https://social.technet.microsoft.com/Forums/windows/en-US/04628368-38ec-4fa5-bce9-655dba741765/cant-pin-windows-explorer-to-taskbar

You may watch the process/registry/file system activity using (so you may simulate it using batch):
https://technet.microsoft.com/en-us/library/bb896645.aspx
This is a "little bit" fiddling, but you may use this program for many similar tasks.

penpen

Edit: Removed the wrong solution "pin Batch files..." as they you cannot pin them (without changing the registry).
Last edited by penpen on 13 Mar 2015 12:32, edited 1 time in total.

penpen
Expert
Posts: 1864
Joined: 23 Jun 2013 06:15
Location: Germany

Re: Pin programs via script or un pin

#18 Post by penpen » 13 Mar 2015 12:23

After i've installed my (new) win 8.1, 32 bit, i reviewed this topic.

If you want to save/recover/deploy a default setting to multiple computers then this might help you:
https://4sysops.com/archives/configure-pinned-programs-on-the-windows-taskbar-with-group-policy/

penpen

npocmaka_
Posts: 498
Joined: 24 Jun 2013 17:10
Location: Bulgaria
Contact:

Re: Pin programs via script or un pin

#19 Post by npocmaka_ » 21 Apr 2015 07:00

penpen wrote:If that is not the reason, maybe localization causes this issue, i've changed the vbs to list all verb names (untested, may contain flaws):

Code: Select all

 '************************************************
' Pin and unpin shortcuts to Windows 7/8 Taskbar
' ~DosProbie - 07.15.13
' Pin.vbs
'************************************************
' ### NOTES
' *** Usage - Pin.vbs
' *** WScript.exe "%~dp0\%~dp0\Pin.vbs" [drive:][path]filename [Argument]
' *** [Arguments] = 0 1 2
' *** 0 = Unpin from Taskbar
' *** 1 = Pin to Taskbar
' *** 2 = Install
' *** <no> = List all Verbs

 Set objShell = CreateObject("Shell.Application")
 Set filesystem = CreateObject("scripting.Filesystemobject")
 If filesystem.FileExists(Wscript.Arguments(0)) Then
  Set objFolder = objShell.Namespace(filesystem.GetParentFolderName(Wscript.Arguments(0)))
  Set objFolderItem = objFolder.ParseName(filesystem.GetFileName(WScript.Arguments(0)))
  Set colVerbs = objFolderItem.Verbs
 
  If WScript.Arguments.Length = 1 Then
   For Each objVerb in colVerbs
    WScript.Echo Replace(objVerb.name, "&", "")
   Next
  ElseIf WScript.Arguments.Length > 1 Then
   Select case WScript.Arguments(1)
    case 0
     For Each objVerb in colVerbs
      If Replace(objVerb.name, "&", "") = "Unpin from Taskbar" Then objVerb.DoIt
     Next
    case 1
     For Each objVerb in colVerbs
      If Replace(objVerb.name, "&", "") = "Pin to Taskbar" Then objVerb.DoIt
     Next
    case 2
     For Each objVerb in colVerbs
      If Replace(objVerb.name, "&", "") = "Install" Then objVerb.DoIt
     Next
   End Select
  End If
 End If

Just call it using cscript within a batch:

Code: Select all

@echo off
%~d0
cd %~d0%~p0
:: List all Verbs available for your file
CScript.exe "%~dp0Pin.vbs" "%userprofile%\Desktop\Builder CPP.exe"
In that case you may replace the 3 Strings "Unpin from Taskbar", "Pin to Taskbar", and "Install" with the localized version.

penpen


I don't know if the author of the thread is still needs this but on my machines verbs look like : "Unpin from Start Men&u" ; "Unpin from Tas&kbar" ; "Pin to Start Men&u" ; "Pin to Tas&kbar" and without the "&"'s the actions cannot be performed. I've a jscript tool that pins /unpins items in start menu and the taskbar and it works on Win8 and Win7.

EDIT : Oh. you are removing the "&"...

Krump
Posts: 45
Joined: 02 Dec 2014 14:53

Re: Pin programs via script or un pin

#20 Post by Krump » 25 Aug 2015 03:43

Hi penpen,

Yours link very help me. i use PowerShell script, and now my "big bat script" works perfect :)

Post Reply