Skip to content

Instantly share code, notes, and snippets.

@JavierJF
Created March 20, 2018 18:52
Show Gist options
  • Save JavierJF/0f06a4a4744168cf39c233fdf23d1e36 to your computer and use it in GitHub Desktop.
Save JavierJF/0f06a4a4744168cf39c233fdf23d1e36 to your computer and use it in GitHub Desktop.
Error: Setting StartMenu layout using C# - dynamically
/*!
* GPII Windows 10 Start Menu Layout Setter.
*
* Copyright 2018 Raising the Floor - International
*
* Licensed under the New BSD license. You may not use this file except in
* compliance with this License.
*
* The research leading to these results has received funding from the European Union's
* Seventh Framework Programme (FP7/2007-2013)
* under grant agreement no. 289016.
*
* You may obtain a copy of the License at
* https://github.com/GPII/universal/blob/master/LICENSE.txt
*/
using System;
using System.IO;
using System.Linq;
using System.Text;
using System.Collections;
using System.Collections.ObjectModel;
using System.Threading;
using System.Threading.Tasks;
using System.Management.Automation;
using System.Management.Automation.Runspaces;
public class Startup {
static void Main(string[] args) {
Type t = Type.GetType("Microsoft.Windows.StartLayout.Commands.CLSID_StartLayoutCmdlet, Microsoft.Windows.StartLayout.Commands, Version=10.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL");
dynamic o = Activator.CreateInstance(t);
MethodInfo processRecord = t.GetMethod("CLSID_StartLayoutCmdlet", BindingFlags.NonPublic | BindingFlags.Instance);
o.Path = @"c:\tmp\aa.xml";
processRecord.Invoke(o, null);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment