McKnife
asked on
Script needed that extracts link targets to a text file
Hi experts.
Preparing a win8.1->win10 migration, I noticed that Microsoft does not migrate the pinned win8.1 start menu tiles to the new start menu - what a shame. And while in win8.1 we could even use GPOs to pin certain installed applications, this feature is deprecated in win10.
I'd like to assist my users in migrating those so I have been looking for a scripted solution.
I found this so far which works: https://gallery.technet.microsoft.com/scriptcenter/Script-to-pin-items-to-51be533c
What I need for completion is a script that we can run against a directory full of link files (.lnk) and that will write the link targets to a text file which can be used by this powershell cmdlet afterwards.
I already found something but I am struggling to get it to work with links that include spaces, so I am looking for help here.
This is it: target.bat from http://www.computerhope.com/forum/index.php?topic=80659.0
I hope to be able to run target.bat somefolderFulloflinks and get a text file like
"c:\somepath\some.exe"
"c:\anotherpath with spaces\another.exe"
...
Preparing a win8.1->win10 migration, I noticed that Microsoft does not migrate the pinned win8.1 start menu tiles to the new start menu - what a shame. And while in win8.1 we could even use GPOs to pin certain installed applications, this feature is deprecated in win10.
I'd like to assist my users in migrating those so I have been looking for a scripted solution.
I found this so far which works: https://gallery.technet.microsoft.com/scriptcenter/Script-to-pin-items-to-51be533c
What I need for completion is a script that we can run against a directory full of link files (.lnk) and that will write the link targets to a text file which can be used by this powershell cmdlet afterwards.
I already found something but I am struggling to get it to work with links that include spaces, so I am looking for help here.
This is it: target.bat from http://www.computerhope.com/forum/index.php?topic=80659.0
I hope to be able to run target.bat somefolderFulloflinks and get a text file like
"c:\somepath\some.exe"
"c:\anotherpath with spaces\another.exe"
...
ASKER
Hi ObdA.
That looks good.
So I modified it a little and started
s\Start Menu\programs. It works but the output is rather large. I am not able to modify it so that it only includes targetpath. Could you help again?
That looks good.
So I modified it a little and started
Get-ChildItem -Path "$env:APPDATA\Microsoft\Windows\Start Menu\programs" -Filter *.lnk | % {D:\Documents\Get-Shortcut.ps1 -Path $_.FullName} | Export-Csv -Path C:\Temp\Shortcuts.csv -NoTypeInformation
so that it will look only in %appdata%\Microsoft\WindowASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Wonderful, thanks. Would have taken me a some time to figure this out.
You should write an article to make it usable for others that like to migrate their start menu tiles to win10.
You should write an article to make it usable for others that like to migrate their start menu tiles to win10.
It'll return a custom object that you can then pipe to Select-Object and/or Export-Csv as you need.
It accepts pipeline input, so you can just pass it the results of a Get-ChildItem. Advertiseed shortcuts are supported.
Example:
Open in new window
Open in new window