contrix_

How and where to upload/download a file with cmd.exe/PowerShell

2 posts in this topic

Posted (edited)

Hello,

I wanted to download files via CMD, and the first way I discovered was FTP. I rent a server and everything worked. The problem is that it takes kinda long to type in the credentials. After some research I found this PowerShell line: 

powershell (new-object System.Net.WebClient).DownloadFile('http://website.com/file.exe','%TEMP%\file.exe')

But I have some questions:

  1.  What is the part after %TEMP% for? Is that the destination where the files "arrives"? So if i wanted to download it to C:\, I just have to change it to C:\, right?
  2. Where can I host the file for free? I found some web server hosting sites, but the only databases I was able to find were FTP and MySQL.

Thank you for your help ;)

Edited by contrix_
0

Share this post


Link to post
Share on other sites

The %temp% is a windows temp folder that is read in from the systems defined path for the temp folder. You could change this to any directory.

If typing a user-name and password is too much to login to ftp, use an ftp client the stores the settings for you and don't use the command line, or, script it. However, know that ftp is a protocol that no matter what, using command line or client, will send all your data in the clear, ie: plain text passwords over the wire and can be sniffed easily. Using something like SCP or SFTP would be a better way to go and avoid plain FTP at all costs if logging into a server remotely, but the service has to setup to enable it.

If you don't care about logging into ftp, there is also wget, which you'd have to install on windows, but is already installed on most llinux systems. Works much the same way as the powershell command.

 wget http://somesite.com/file -O filename.xxx

where -O means output and filename.xxx is the file to save it to. You can add a whole path too, just put it in quotes like

"c:\user\name\desktop\soem folder on desktop\file.xxx"

0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.