# encoding: ascii
# api: powershell
# title: W8 PseudoStartMenu
# description: This function creates or updates a combined Startmenu folder, which you can attach to you toolbar (cf. http://www.howtogeek.com/107711/how-to-get-the-classic-start-menu-back-in-windows-8/) or my blog http://pauerschell.blogspot.de/
# version: 0.1
# type: function
# author: Bernd Kriszio
# license: CC0
# function: Update-FakeWindow8Startmenu
# x-poshcode-id: 3583
# x-archived: 2015-04-24T02:05:00
# x-published: 2015-08-19T03:26:00
#
#
function Update-FakeWindow8Startmenu
{
    $StartMenu = "C:\Startmenu"
    remove-item $StartMenu -Recurse -Force
    $path1 = "$env:ProgramData\Microsoft\Windows\Start Menu\Programs"
    gci $path1 -rec | % {
        cp $_.fullname     "$StartMenu\$($_.fullname.substring($path1.Length + 1))"
    }

    $path2 = "$env:AppData\Microsoft\Windows\Start Menu\Programs"
    gci "$env:AppData\Microsoft\Windows\Start Menu\Programs" -Recurse | % {
        cp $_.fullname  "$StartMenu\$($_.fullname.substring($path2.Length + 1))" -ea SilentlyContinue
    }

}
