質問

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..

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

So the question is How do you specify the username in ftp upload

役に立ちましたか?

解決

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
....
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top