One Liners – Windows FTP Command Prompt
There comes a time as an IT Support Professional/MSP when sometimes you need to ftp from the command prompt and combine the username, password and file to download in one line without having to use a separate text file. This is particularly true when performing remote administration tasks remotely where having a separate text file to call the username and password etc… isn’t possible. Here’s a simple one liner to accomplish the task.
echo open WEBSITE >> ftp &echo user USERNAME PASSWORD >> ftp &echo binary >> ftp &echo get FILENAMETODOWNLOAD >> ftp &echo bye >> ftp &ftp -n -v -s:ftp &del ftp
Simply replace these details:
- WEBSITE – Enter the FTP address. This can be an IP address or an FTP url such as ftp.mysite.com
- USERNAME – The username for the FTP site
- PASSWORD – The password for the FTP site (omit this if logging in anonymously)
- FILENAME TO DOWNLOAD – e.g. myfile.msi
If you found this useful please share. It may just help one of your colleagues out.