The Artima Developer Community
Sponsored Link

.NET Buzz Forum
Monad Script: download-file

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Peter G Provost

Posts: 849
Nickname: pprovost
Registered: Aug, 2003

Peter G Provost is a Solution Architect for Interlink Group in Denver, CO.
Monad Script: download-file Posted: Nov 1, 2005 11:12 PM
Reply to this message Reply

This post originated from an RSS feed registered with .NET Buzz by Peter G Provost.
Original Post: Monad Script: download-file
Feed Title: Peter Provost's Geek Noise
Feed URL: /error.aspx?aspxerrorpath=/Rss.aspx
Feed Description: Technology news, development articles, Microsoft .NET, and other stuff...
Latest .NET Buzz Posts
Latest .NET Buzz Posts by Peter G Provost
Latest Posts From Peter Provost's Geek Noise

Advertisement

Have you ever found a something on the web and wanted to download it but there isn’t a link? If you have the URL but don’t have a link that you can right-click to save, you can use this little MSH script:

Put the following into a file called download-file.msh:

$webclient = new-object System.Net.WebClient
$start = $args[0].LastIndexOf("/") + 1
$len = $args[0].LastIndexOf("?") - $start
if( $len -lt 0 ) { $len = $args[0].Length - $start  }
$target = [System.IO.Path]::Combine( $(get-location), $args[0].Substring( $start, $len ) )
$webclient.DownloadFile($args[0], $target)

Now from a MSH prompt you can type…

MSH:1> download-file "http://www.peterprovost.org/Skins/peter2/Images/Title.png"

…and it will download the header image from my blog to your current directory. You can use it with just about anything.

Enjoy!

Read: Monad Script: download-file

Topic: Emily's Pumpkin Theory Previous Topic   Next Topic Topic: Hot Air Balloonist: A Story of IT and Management

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use