How to use FTP from the command line.

How to use FTP from the command line.

FTP (File Transfer Protocol) allows you to transfer files between your PC and other Internet systems (hosts). You can transfer files, work with local or remote directories, rename and display files, and execute system commands. Before you start, you must know how to log on to the remote system and have a userid and password on that system. 

Note: Some systems allow anonymous ftp access. To use  anonymous ftp, use  anonymous as your userid and your e-mail address as the logon password.

Logging Onto and Off of a Remote System

To begin using Microsoft's FTP client, Open a command prompt and switch to the destination directory (where you want the download file).

To start an FTP session, enter: ftp host_name 
where hostname is the name or IP address of the remote system.

You will then be asked to enter your userid and password.

Once you have successfully logged onto a remote system, you will be able to use ftp commands to view a listing of files on the remote system and transfer files between the two systems.

Example: Download i386.exe (Windows NT 3.5 Resource Kit) from ftp://ftp.microsoft.com/bussys/winnt/winnt-public/reskit/nt35/i386 to C:\Temp\Download

  1. Open a command prompt. Enter CD C:\Temp\Download (assuming that directory exists). 
    Enter: ftp ftp.microsoft.com 

    You should now see a prompt similar to this: 
    Connected to ftp.microsoft.com. 
    220 Microsoft FTP Service 
    User (ftp.microsoft.com:(none)):

  2. For the userid, Enter: anonymous 

    You should see a prompt similar to this: 
    331 Anonymous access allowed, send identity (e-mail name) as password. 
    Password:

  3. Enter: userid@domain.com as the password at the "Password:" prompt. 
    Note: Any e-mail address in a userid@domain.com format should work. You will not be able to see the password as you type it.

  4. To download i386.exe from the bussys/winnt/winnt-public/reskit/nt35/i386 directory, Enter: get bussys/winnt/winnt-public/reskit/nt35/i386/i386.exe

    Note: You could have also used ls to view the directory and file names, cd bussys/winnt/winnt-public/reskit/nt35/i386 to switch directories, and get i386.exe to download the file from within that directory.

  5. To end the FTP session, Enter: quit or bye.

Note: Once you have extracted the resource kit, you will have to expand individual files 
example: expand choice.ex_ choice.exe

FTP Commands

For a list of FTP commands, at the "ftp>" prompt, Enter:  help

When using ftp from the command prompt, the following list of supported commands will be displayed: 
Note: Hover your mouse over a command to see what the output of "help *" is for that command.

!   
delete
literal
prompt
send
?   
debug
ls  
put 
status
append
dir
mdelete
pwd 
trace
ascii
disconnect
mdir
quit
type
bell
get 
mget
quote
user
binary
glob
mkdir
recv
verbose
bye 
hash
mls 
remotehelp
 
cd  
help
mput
rename
 
close
lcd 
open
rmdir
 

The question mark (?) command is equivalent to the help command. Typing help or ? followed by the name of a command will display a brief description of the command's purpose.

The exclamation point (!) can be used to shell to the system (command) prompt. Type Exit to return to the FTP session. You can also issue a subset of system commands to perform as you shell out, e.g., ! dir %windir% | more. When the commands in the shell have completed, you will be returned to the FTP session.

The pwd command will list the current directory on the remote machine. To change directories on the remote machine, use the cd command. To create a new directory on the remote machine, use the mkdir command followed by the name you would like to assign to the new directory. The lcd command can be used to change directories on the local (PC) machine.

To display a listing of files on the remote system, enter: ls or dir.

To download a file (copy a file from the remote system to your PC), you can use the command get or recvfollowed by the name of the file you would like to download. Optionally, you can follow the filename with a second filename which will be assigned to the file when it is downloaded to your PC. To download multiple files, you can use the mget command followed by a descriptor for the files you would like to download (e.g.: *.f for all files ending in ".f" or *.* for all files). You will be prompted to indicate whether you would like to download each file in turn. To turn off this prompting, enter the prompt command prior to entering the mget command; you will receive the message "Interactive mode OFF" indicating that prompting has been deactivated.

By default, files are downloaded and uploaded in ASCII file transfer mode. To download or upload files using Binary format mode, enter the command Binary at the "ftp>" prompt prior to downloading or uploading the file(s). To return to ASCII file transfer mode, enter the ASCII command.

To upload a file (copy a file from your PC to the remote system), you can use the command put or send followed by the name of the file you would like to upload. Optionally, you can follow the filename with a second filename which will be assigned to the file when it is uploaded to the remote system. The mput command can be used to upload multiple files.

You can use the close or disconnect command to drop the current ftp connection without exiting from the command enironment and then use the open command to connect to a new host.


Much of this article was taken from the dead link, http://www.cc.vt.edu/cc/us/docs/faqlib/windows95/clients/msftp.html

To see the original article, go to http://web.archive.org/web/*/http://www.cc.vt.edu/cc/us/docs/faqlib/windows95/clients/msftp.html
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
In .NET 6 and later versions, the `System.Windows.Forms` namespace is not included in the default installation of WPF applications. However, you can still use the `FolderBrowserDialog` class in your WPF application by adding a reference to the `System.Windows.Forms` NuGet package and using the `System.Windows.Forms.Integration` namespace. Here are the steps to use `FolderBrowserDialog` in .NET 6 WPF: 1. Add a reference to the `System.Windows.Forms` NuGet package in your WPF project. 2. Add the following using statements to the top of your code file: ```csharp using System.Windows.Forms; using System.Windows.Forms.Integration; ``` 3. In your code, create a `FolderBrowserDialog` object and use the `ShowDialog` method to display the dialog box: ```csharp FolderBrowserDialog dialog = new FolderBrowserDialog(); if (dialog.ShowDialog() == DialogResult.OK) { // do something with the selected folder } ``` 4. If you want to use the `FolderBrowserDialog` in a WPF window or page, you can use the `WindowsFormsHost` control to host the dialog box: ```xml <Window xmlns:winforms="clr-namespace:System.Windows.Forms.Integration;assembly=WindowsFormsIntegration" xmlns:forms="clr-namespace:System.Windows.Forms;assembly=System.Windows.Forms" ...> <Grid> <winforms:WindowsFormsHost> <forms:FolderBrowserDialog x:Name="folderDialog" /> </winforms:WindowsFormsHost> </Grid> </Window> ``` Then, you can use the `ShowDialog` method to display the dialog box: ```csharp if (folderDialog.ShowDialog() == DialogResult.OK) { // do something with the selected folder } ``` Note that you will also need to add a reference to the `WindowsFormsIntegration` assembly in your WPF project.

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值