你如何通过批处理文件指定ftp上传的用户名 [英] How do you specify the username in ftp upload by a Batch file

查看:161
本文介绍了你如何通过批处理文件指定ftp上传的用户名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使一批从正在使用该程序的用户自动上传重要文件。所以我所做的就是%USERNAME%目录前。 C:\\用户\\%USERNAME%\\ importantfiles

I want to make a batch that auto uploads important files from the user that is using the program. so what I did was %username% in the directory Ex. C:\user\%username%\importantfiles

open (ftp server name)
(ftp user-name)
(ftp password)
prompt
bin
mput c:\user\%username%\importantfiles 

有许多用户必须能够使用这个..

There are many users that must be able to use this..

所以,C:\\用户\\麦克风\\ importantfiles将无法正常工作

So the "C:\user\mike\importantfiles" will not work

所以,问题是如何您指定的用户名FTP上传

推荐答案

您需要将生成批处理的FTP脚本文件。

You will need to generate the ftp script file from your batch.

喜欢的东西(只是一个骨架)

Something like (just a skeleton)

....
set "ftpScript=%temp%\%~nx0.ftp.tmp"
(
    echo open (ftp server name)
    echo (ftp user-name)
    echo (ftp password)
    echo prompt
    echo bin
    echo mput "c:\user\%username%\importantfiles\*.*"
    echo quit
) > "%ftpScript%"

ftp -s:"%ftpScript%"
del /q "%ftpScript%" >nul 2>nul
....

这篇关于你如何通过批处理文件指定ftp上传的用户名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆