ProcessBuilder pb = new ProcessBuilder("notepad");
pb.environment().put("TEST", "foobar");
Process p = pb.start();
Thread.sleep(100); // Try to give the process a little time to start or getting the command line fails randomly
WinProcess wp = new WinProcess(p);
System.out.println("pid=" + wp.getPid());
System.out.println(wp.getCommandLine());
assertTrue(wp.getCommandLine().contains("notepad"));
System.out.println(wp.getEnvironmentVariables());
assertEquals("foobar", wp.getEnvironmentVariables().get("TEST"));
Thread.sleep(100);
wp.killRecursively();
}