/\/\o\/\/ PowerShelled

This blog has moved to http://ThePowerShellGuy.com Greetings /\/\o\/\/
$AtomFeed = ("Atom.xml")
$PreviousItems = (" PowerShell : How Can I Rename Files Using File Nam... "," PowerShell make a drive of an UNC path "," Some Powershell News "," PowerShell Import and Export a DirectoryTree and S... "," PowerShell How Can I Query a Text File and Retriev... "," PowerShell Import Shares and Security info From CSV "," An other PowerShell Blog is born "," Windows PowerShell: TFM "," PowerShell Export Shares and Security info to CSV "," powershell (Monad) Home on computerperformance.co.uk "," ")

Saturday, May 13, 2006

 


PowerShell Celsius Fahrenheit converting



Just a quick one,
as I needed to convert some temperatures, I did this 2 functions,
no magic here, but still they can come handy ;-)

MowPS>function ConvertTo-Fahrenheit ($Celsius) {$Celsius * 1.8 + 32}

MowPS>ConvertTo-Fahrenheit 25
77

MowPS>function ConvertTo-Celsius ($Fahrenheit) {($Fahrenheit - 32) / 1.8}

MowPS>ConvertTo-Celsius 77
25


Enjoy,

Greetings /\/\o\/\/
Tags :


Comments:
Anonymous Anonymous
Consider this variation:

function ConvertTo-Fahrenheit ($Celsius$(Throw "USAGE: ConvertTo-Fahrenheit -Celsius degrees")) {
"{0:N1}" -f ($Celsius * 1.8 + 32)
}

function ConvertTo-Celsius ($Fahrenheit=$(Throw "USAGE: ConvertTo-Celsius -Fahrenheit degrees")) {
"{0:N1}" -f (($Fahrenheit - 32) / 1.8)
}
 
Post a Comment



<< Home

Archives

October 2005   November 2005   December 2005   January 2006   February 2006   March 2006   April 2006   May 2006   June 2006   July 2006   August 2006   September 2006   October 2006   November 2006   December 2006  

$Links = ("PowerShell RC1 Docs"," PowerShell RC1 X86"," PowerShell RC1 X64"," Monad GettingStarted guide"," Monad Progamming Guide"," Monad SDK"," Monad videos on Channel 9"," MSH Community Workspace"," scripts.readify.net "," MonadSource"," www.reskit.net"," PowerShell Blog"," Under The Stairs"," computerperformance powershell Home"," proudlyserving"," MSH on wikipedia"," MSHWiki Channel 9"," Keith Hill's Blog"," Precision Computing"," PowerShell for fun"," MSH Memo (Japanese)"," monadblog")

find-blog -about "PowerShell","Monad" | out-Technorati.
find-blog -contains "","" | out-Technorati.
Google
 
Web mow001.blogspot.com

This page is powered by Blogger. Isn't yours?