-
Notifications
You must be signed in to change notification settings - Fork 0
/
PIN.vbs
34 lines (28 loc) · 1.1 KB
/
PIN.vbs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
Dim strFolder, strExecutable
strFolder = Wscript.Arguments.Named("folder")
strExecutable = Wscript.Arguments.Named("file")
strFolder = "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\WSLApps"
strExecutable ="glade.lnk"
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.Namespace(strFolder)
Set objFolderItem = objFolder.ParseName(strExecutable)
Set colVerbs = objFolderItem.Verbs
'uncomment this section to display the available verbs
' For Each objVerb In colVerbs
' If objVerb <> "" Then
' WScript.Echo objVerb
' End If
' Next
'Loop through the verbs and if PIN is found then 'DoIt' (execute)
blnOptionFound = False
For Each objVerb In colVerbs
'WScript.Echo objVerb.name
If instr( objVerb.name , "¹Ì¶¨µ½" ) > 0 then
objVerb.DoIt
blnOptionFound = True
' WScript.Echo "The application '" & strExecutable & "' was just Pinned to the Start Menu."
End If
Next
'if blnOptionFound = false then
' WScript.Echo "The application '" & strExecutable & "' failed to pin to the Start Menu (may already be present)."
'end if