文件传输协议File Transfer Protocol

通过文件传输协议(FTP),可以在 Windows 10 IoT 核心设备之间传输文件The File Transfer Protocol (FTP) allows you to transfer files to and from your Windows 10 IoT Core device

重要

建议通常将 FTP 用于开发人员简化初始开发过程。FTP is recommended generally for developers to ease the initial development process. 不建议在零售设备中使用 FTP。We do not recommend using FTP in retail devices.

在你的设备上启动 FTP 服务器Starting the FTP server on your device

  • 默认情况下,在 IoT 核心设备上禁用 FTP 服务器。By default, the FTP server is disabled on your IoT Core device. 若要在设备上启动 FTP 服务器,首先需要通过PowerShellSSH连接到设备。In order to start the FTP server on your device, first you need to connect to your device through PowerShell or SSH.
  • Type start C:\Windows\System32\ftpd.exeType start C:\Windows\System32\ftpd.exe
  • 你可以通过键入 tlist 检查该服务器是否正在运行,这将列出所有运行中的进程。You can check that the server is running by typing tlist, which will list all the running processes. 如果 FTP 服务器正在运行,你应该能在该列表中看到 ftpd.exeIf the FTP server is running, you should see ftpd.exe in the list.

FTP 启动

停止在你的设备上运行 FTP 服务器Stopping the FTP server on your device

  • 若要在 IoT Core 设备上停止 FTP 服务器,首先需要通过PowerShellSSH连接到设备。In order to stop the FTP server on your IoT Core device, first you need to connect to your device through PowerShell or SSH.
  • 如果使用 PowerShell 进行连接,请键入 kill -processname ftpd* 以停止 FTP 进程。If you connected using PowerShell, type kill -processname ftpd* to stop the FTP process.

FTP PowerShell 停止

  • 如果使用 SSH 进行连接,请键入 kill ftpd* 以停止 FTP 进程。If you connected using SSH, type kill ftpd* to stop the FTP process.

FTP SSH 停止

通过 FTP 访问文件Accessing your files over FTP

  • IoT Core 设备上的 FTP 服务器在启动时自动启动。The FTP server on your IoT Core device starts automatically on boot. 若要连接到它,需要你的设备的 IP 地址。In order to connect to it, you need the IP address of your device. 你可以在默认应用上找到该 IP 地址,该应用会在设备启动时启动。You can find the IP address on the default app that boots when your device starts.

Windows IoT 核心版上的 DefaultApp

  • 获得 IP 后,在电脑上打开文件资源管理器并键入 "ftp://<TARGET_DEVICE>",其中 <TARGET_DEVICE> 为设备的名称或 IP 地址,然后按 Enter。Once you have the IP, open up File Explorer on your PC and type ftp://<TARGET_DEVICE>, where <TARGET_DEVICE> is either the name or the IP address of your device, then hit Enter. 如果出现提示,请输入你的管理员用户名和密码。Enter your administrator username and password if prompted.

FTP 资源管理器

  • 现在,你可以通过 FTP 访问你的设备上的文件。Now you can access the files on your device through FTP.

更改 FTP 根目录Changing the root FTP directory

  • 默认情况下,FTP 服务器显示设备的根目录 C:\中的所有文件夹。By default the FTP server displays all the folders in the device's root directory C:\. 若要更改根目录,请执行相同的步骤来启动 FTP 服务器,只需将根目录作为参数传入。In order to change the root directory, follow the same steps to start the FTP server, except you need to pass in the root directory as a parameter.
  • 若要更改它,请先通过 PowerShellSSH 连接到你的设备。In order to change it, first connect to your device through PowerShell or SSH.
  • 如果 FTP 进程已在运行,请停止该进程。Stop the FTP process if it's already running.
  • 键入 start C:\Windows\System32\ftpd.exe <PATH_TO_DIRECTORY>,其中 <PATH_TO_DIRECTORY> 是要设置为根目录的目录的绝对路径,例如 C:\Users\DefaultAccountType start C:\Windows\System32\ftpd.exe <PATH_TO_DIRECTORY>, where <PATH_TO_DIRECTORY> is the absolute path to the directory you want to set as the root directory, such as C:\Users\DefaultAccount.

带有参数的 FTP 启动

现在,当你通过 FTP 连接到设备时,你将看到你设置的根目录的内容。Now when you connect to your device through FTP, you will see the contents of the root directory you set.

具有新的根目录的 FTP 资源管理器

若要将此更改设置为永久性更改,你需要添加对 start ftpd.exe <PATH_TO_DIRECTORY> 的调用,其中 <PATH_TO_DIRECTORY> 是要设置为根目录的目录的绝对路径(例如,C:\Data\Users\DefaultAccount 到 OEMCustomization)并将其放在 C:\Windows\System32In order to make this change permanent, you need to add a call to start ftpd.exe <PATH_TO_DIRECTORY> where <PATH_TO_DIRECTORY> is the absolute path to the directory you want to set as the root directory, such as C:\Data\Users\DefaultAccount to OEMCustomization.cmd and place it in C:\Windows\System32