Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Is there a windows equivalent of Linux's "get" command in windows that I can use to obtain remote objects? I want to be able to have a batch file download a remote file on execution.

share|improve this question
    
possible duplicate: superuser.com/questions/362152/… –  mnmnc Apr 2 '13 at 0:45
1  
Any restriction that prevents you from using wget, curl and so on? –  Karan Apr 2 '13 at 0:56
add comment

1 Answer

up vote 2 down vote accepted

Assuming you use windows powershell, is this what you are looking for:

If you just need to retrieve a file, you can use the DownloadFile method of the WebClient object:

$client = new-object System.Net.WebClient

$client.DownloadFile( $url,$path )

Where $url is a string representing the file's URL, and $path representing the local path the file will be saved to.

Note that $path must include the file name; it can't just be a directory.

Comes from this topic: Native alternative to wget in Windows PowerShell?

share|improve this answer
    
This is just a batch file run from an elevated command prompt. Will this work in a plain old command prompt? –  nate302 Apr 2 '13 at 0:50
    
I don't think it will run in the CMD that comes with XP/Vista. From Win7 onwards, PowerShell comes out of the box. If you don't have PowerShell and you are familiar with unix shell script, why not try Cygwin? –  Vincent Apr 2 '13 at 0:57
    
It's a server 2008 r2 box and I've not seen Cygwin. Is there a way without using Cygwin? (get is probably the only linux command I'd be using) –  nate302 Apr 2 '13 at 0:59
    
I believe it is possible to install PowerShell on server 2008: tech-recipes.com/rx/2521/… or technet.microsoft.com/en-us/library/hh847837.aspx Would that be an option for you? –  Vincent Apr 2 '13 at 1:03
    
I have powershell, I may just write a small program for it instead as I'd like it to work on windows systems without powershell as well. –  nate302 Apr 2 '13 at 1:07
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.