Last active
December 16, 2015 12:09
-
-
Save troykershaw/5432434 to your computer and use it in GitHub Desktop.
The HP TRIM SDK isn't registered in the GAC when TRIM is installed, so you need to add it to the 'PATH' environment variable before you can use it. Here's a simple console app that shows how I do it.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Microsoft.Win32; | |
using System; | |
namespace TrimDemo | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
//The TRIM SDK isn't registered in the GAC when TRIM is installed, | |
//so you need to add it to the 'PATH' environment variable | |
InitialiseTrim(); | |
//For some reason unbeknownst to me, you still can't use the TRIM SDK from | |
//within this method, you need to do it from within another method, like this one... | |
BootstrapApp(); | |
} | |
static void InitialiseTrim() | |
{ | |
//Get the TRIM installation directory from the registry | |
var trimPath = Registry.LocalMachine.GetValue( | |
@"SOFTWARE\Hewlett-Packard\HP TRIM\MSISettings\INSTALLDIR", | |
@"C:\Program Files\Hewlett-Packard\HP TRIM\"); | |
//And add it to the 'PATH' environment variable in | |
Environment.SetEnvironmentVariable("PATH", | |
string.Format("{0};{1}", Environment.GetEnvironmentVariable("PATH"), trimPath), | |
EnvironmentVariableTarget.Process); | |
} | |
static void BootstrapApp() | |
{ | |
//You can happily access TRIM from here. | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment