0

好的,我正在构建一个相当大的批处理程序来控制 100 多个 DRAC 端口的电源,并且一切都已构建、测试和工作。然而; 我想让它自动将 plink.exe 通过 ftp 从下载网站下载到 c:\ 目录中,只需让同事回答有关他们是否已在本地计算机上安装程序的问题,以便他们不必浏览它。
这是我一直在研究的部分:

SET /p ANSWER=Have you downloaded plink.exe (Y/N)?
if /i {%ANSWER%}=={Y} (goto :Continue)
if /i {%ANSWER%}=={N} (goto :Download)
:Download
echo Starting Plink.exe download!!!
timeout /t 2
Site from which I will be downloading:
ftp://ftp.blahblahblah.com
:Continue
4

1 回答 1

0

要在 Windows 上自动执行内置 ftp.exe 的命令,您必须将它们存储在单独的文件中

:start
SET /p ANSWER=Have you downloaded plink.exe (Y/N)?
if /i {%ANSWER%}=={Y} (goto :Continue)
if /i {%ANSWER%}=={N} (goto :Download)
goto start

:Download
echo Starting Plink.exe download!!!
rem timeout using ping command
PING 1.1.1.1 -n 1 -w 2000 >NUL

rem Write the commands - remove the ones you don't need, such as username and password
echo user USERNAME> ftpcmd.dat
echo PASSWORD>> ftpcmd.dat
echo bin>> ftpcmd.dat
echo get plink.exe>> ftpcmd.dat
echo quit>> ftpcmd.dat

rem run ftp command
ftp -n -s:ftpcmd.dat ftp.blahblahblah.com

rem delete the extra file.
del ftpcmd.dat

:Continue

马丁

于 2013-07-29T21:15:57.590 回答