#
#
#2018-04-03 19:43:31
PowerShell
#, 2018-04-03 19:43:31

How to programmatically pin a shortcut to the Win 10 Start Screen?

subj actually. preferably in C#. but C, PowerShell, CMD/BAT are also good, as long as it really works,
we are talking about a set of shortcuts already created by the program (well, or how to create a shortcut with pinning to "start" take out10). once upon a time, I found an example for C #, but it does not work

static void links2start()
        {
            dynamic sa = Activator.CreateInstance(Type.GetTypeFromProgID("Shell.Application"));
            dynamic ll = sa.NameSpace(linkLocation);
            dynamic lnk = ll.ParseName("body.lnk");
            foreach (dynamic verb in lnk.Verbs)
                if (verb.Name == "&Pin to Start")
                    verb.DoIt();
        }

thanks
plz, see comments, maybe you will notice what to add

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
azarij, 2018-04-03
@mindtester

for c:\windows\system32\calc.exe first create a shortcut in C:\Users\USER\AppData\Roaming\Microsoft\Windows\Start Menu\Programs.
then turned around:
(New-Object -ComObject shell.application).namespace('c:\windows\system32\').parsename('calc.exe').invokeverb('pintostartscreen')
strange, but works like

M
Mercury13, 2018-04-03
@Mercury13

There are ways, but they change periodically.
It's Microsoft's policy that programs shouldn't pollute these screens.
https://blogs.msdn.microsoft.com/oldnewthing/20030...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question