Getting OS and Version Information from ColdFusion

As in many cases like this, dropping into Java helps us get the job done:

<cfset sys = createObject("java", "java.lang.System") />
<cfdump var="#sys.getProperties()#" />

So for example, if I need the version of the OS for a user string:

<cfoutput>
(Windows; U; Windows NT #x.getProperty("os.version")#; #x.getProperty("user.language")#-#x.getProperty("user.country")#)
</cfoutput>

This outputs (Windows; U; Windows NT 6.1; en-IE) for me.

If you need to get ColdFusion details (such as version number) there is a handy struct in the SERVER scope:

<cfdump var="#SERVER.ColdFusion#" />
Advertisements
This entry was posted in regular and tagged , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s