Using Powershell to Generate TinyURLs

Sunday, June 22 2008 -

I cam across a small Powershell function that will allow you to pass a URL to it and it will return a TinyURL.

TinyURL is a web service that provides short aliases for long URLs. Here's a function to generate URL aliases using TinyURL's API. The returned URL is short and never expires.

Here is the function and a small example of how to use it. Thanks to Shay for passing this on.


function New-TinyUrl($url)
{ 
 
(new-object net.webclient).downloadString("http://tinyurl.com/api-create.php?url=$url") 
}

 

PS > $vug = New-TinyUrl -url http://marcoshaw.blogspot.com/2008/06/windows-powershell-virtual-user-group.html

PS > $vug

PS > http://tinyurl.com/4k9ons

PS > (new-object -com shell.application).open($vug)

 

Here is the link to the original post.

Technorati Tags:
kick it on DotNetKicks.com kick it on gamedevkicks.com

Similar Posts

  1. Creating a DiggIt Module for Community Server 2007
  2. Phoenix, Drawing Text on the Screen
  3. Creating a DirectX Device plus more.
Clicky Web Analytics