Monthly Archives: January 2014

Simple PowerShell to add PortableApps to your Windows 8 or 8.1 Start Menu

Copy the below code to your machine and edit the $folder line to match the location of your PortableApps you can check you have the correct folder by doing a dir with it and ensuring all your portable apps come up.

To undo what the script does then remove the folder “%appdata%\microsoft\windows\Start Menu\Programs\Portable\“

No warranty or suchlike – for information only.  Publication requires leaving a comment with a reference to each article and source must be provided with all use

 

Save it to your DropBox to run when you go onto a new machine.  Will work best if you always mount your DropBox drive in the same location.  You can always adjust the script to search for the Dropbox folder

### ### Copyright (C) Al West, 2014, TSEW, UK. ### ### Change the line of code below to match the folder where your ### portable apps are - if you omit the filter then everything found ### will be added. Not good! ### ### To delete links remove the following folder ### (copy and paste into explorer window): ### %appdata%\microsoft\windows\Start Menu\Programs\Portable\ ### ### Running this again will only recreate the shortcuts ### It will not delete redundant ones. ### Also not all files have portable in their name so it doesn't ### cover everything. ### $folder = "D:\Dropbox\Portable\PortableApps\*Portable.exe" ### ############################################################## function makeSC ( [string]$portableApp ) { $appName = [io.path]::GetFileNameWithoutExtension($portableApp) $location = $env:APPDATA + "\Microsoft\Windows\Start Menu\Programs\Portable\" $WshShell = New-Object -ComObject WScript.Shell Write-Host "Creating:" $appName " <<>> " $portableApp Write-Host " in:" $location $Shortcut = $WshShell.CreateShortcut( $location + $appName + ".lnk") $Shortcut.TargetPath = $portableApp $Shortcut.Save() } $files = Get-ChildItem -Path ($folder) -Recurse foreach ($file in $files) { makeSC ($file) }

Advertisements
Advertisements