Upload files to FTP server using Windows build-in FTP client
You can FTP upload files with Windows onboard utilities only. Just create a CMD script with the code below and place a shortcut in your sendto folder (Win+R→ shell:sendto) for quick context menu access
The "mapped folder" feature request will work too. Filezilla users know this ability as synchronized browsing.
>> %ftp% ECHO open 123.4.567.89
>> %ftp% ECHO user FTPUSER FTPPASSWORD
>> %ftp% ECHO cd "%mappedfolder%"
>> %ftp% ECHO binary
>> %ftp% ECHO send %1
>> %ftp% ECHO disconnect
>> %ftp% ECHO quit
ftp.exe -n -i -s:%ftp%
Enter your FTP credentials
FTPPASSWORD and the IP address with your own FTP login data
C:\MAPPEDFOLDER1\MAPPEDFOLDER2\ to the mapped folder on your local PC
Note: If you upload a file from outside of your mapped folder, the file will be saved into your FTP root folder by default.
How does the script work (Example file
- Only the path from your selected file is saved as inputfolder:
- The third line compares the input path and your hard coded mapped path (eg.
C:\some\). As a result you get
folder\ as mapped folder. Later the script tries to open this folder on your FTP root directory
- Line 5-12 creates a temporary text file (script.ftp) through multiple echo commands.
All your FTP commands are written into this textfile.
- The Windows build-in FTP client is called with
ftp.exe -n -i -s:%ftp% and gets the FTP command file as parameter. So it knows what to do:
- First, the FTP program opens a connection to your server together with your login credentials
cd "%mappedfolder%" is used to synchronize your input path and the FTP path structure. Fortunately, it can open multiple folders with one call.
binary is just a default setting for the file transfer method
send %1 finally sends our file. The batch argument
%1 represents the input full filename
- After the transfer finishes, we disconnect from the FTP server and close the FTP client
- The last 3 lines are just for cleaning up our traces like deleting the FTP command file
pause will give you the chance to see the script output if all went fine.