So I was curious if the path to the windows command line interpreter (cmd.exe) could be obtained programatically. I discovered it can with ColdFusion 8. The java.lang.System class contains a method called getenv that can return the value of a specific environment variable. From what I have read, most windows versions store the path to the command line interpreter in a variable named COMSPEC. So I was able to display the path using this snippet:
<cfset pathToExe = createObject("java", "java.lang.System").getEnv("COMSPEC")>
<cfdump var="Path = #pathToExe#">
.. and display all environment variables using:
<cfset environ = createObject("java", "java.lang.System").getEnv()>
Unfortunately it does not work with MX 7. MX 7 uses and older jvm (version 1.4), which does not contain one of the getenv() methods and the other is marked as deprecated. Fortunately, getenv() was resurrected in time for jvm 1.6, making it easy to read windows environment variables under ColdFusion 8.