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

One thought on “Simple PowerShell to add PortableApps to your Windows 8 or 8.1 Start Menu

  1. And the instructions on how to create a powershell script.

    1. Create the script in a plain text editor such as Notepad and save with a .PS1 file extension (for example, myscript.ps1).

    2. Run the script by entering the full path to the script (c:\scripts\myscript.ps1), or if it’s in the current directory, prefix it with a period followed by a backslash (.\myscript.ps1).

    3. If the path to the script contains a space, enclose the full path in quotation marks and prefix the entire thing with an ampersand (for example: &”C:\my scripts\myscript.ps1″).

    ** Unless you’re running a signed script, make sure you to set the correct execution policy using Set-ExecutionPolicy. To allow local scripts to run unsigned, run:

    Set-ExecutionPolicy RemoteSigned

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: