Saturday, June 21, 2008

Generating TinyURLs from PowerShell


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.

function New-TinyUrl($url){
    (new-object net.webclient).downloadString("$url") 
PS > $vug = New-TinyUrl -url
PS > $vug
PS >


Test it in your default browser:

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



1 comment:

Jeffery Hicks said...

My Out-Twitter function ( uses something similar but with Snurl

Function Get-Snurl {
$webclient=New-Object Net.WebClient
write $response