Yahoo 知識+ 將於 2021 年 5 月 4 日 (美國東岸時間) 停止服務,而 Yahoo 知識+ 網站現已轉為僅限瀏覽模式。其他 Yahoo 資產或服務,或你的 Yahoo 帳戶將不會有任何變更。你可以在此服務中心網頁進一步了解 Yahoo 知識+ 停止服務的事宜,以及了解如何下載你的資料。
first time to create .bat ...
ipconfig /all
ftp -A download.speedtest.com.hk
get 100MBvideo.zip
after save as .bat , it stop at ftp>
but by hand is ok .. why?
(u can try yourself then u will know the problem ... by hand ok , autorun can't ...) any solution ?
2 個解答
- ?Lv 71 十年前最愛解答
You are incorrect in concept.
when you type ftp on command line, it has started the ftp program, so the next line you type is command to ftp program instead of to the command prompt.
When you execute a batch file, and entered ftp, the next line is another line execute under command line instead of enter into the ftp program, so after you exit the ftp program, it will execute the next line, but of course you will get another error.
to overcome, you may try the following, but it cannot resolve all problems
ipconfig /all
get 100MBvideo.zip | ftp -A download.speedtest.com.hk
- 1 十年前
@echo off
rem FileSize= 10Mb or 100MB
set FileSize=10MB
if "%1"=="10MB" set FileSize=10MB
if "%1"=="100MB" set FileSize=100MB
set downloadcmdFile=downloadcmd.txt
set uploadcmdFile=uploadcmd.txt
set VideoFile=%FileSize%video.zip
set DownloadHost=download.speedtest.com.hk
set UploadHost=upload.speedtest.com.hk
if "%OS%"=="Windows_NT" goto SystemOK
Echo Warning: This script has been tested on Windows XP only.
echo Press Ctrl+C to end or
pause
:SystemOK
echo Start
rem Use 'ftp' as username and password
echo ftp> %downloadcmdFile%
echo ftp>> %downloadcmdFile%
echo get %VideoFile%>> %downloadcmdFile%
echo bye>> %downloadcmdFile%
rem Use 'ftp' as username and password
echo ftp> %uploadcmdFile%
echo ftp>> %uploadcmdFile%
echo put %VideoFile%>> %uploadcmdFile%
echo bye>> %uploadcmdFile%
cls
title SpeedTest (Ctrl-c to cancel)
echo This script will perform both download and upload tests by downloading and uploading a %FileSize% file with speedtest.com.hk.
echo.
echo Press Ctrl+C to end or
pause
echo ------------------------------------------------------------------
echo Performing Download test ......
ftp -s:%downloadcmdFile% %DownloadHost%
echo ------------------------------------------------------------------
echo Performing Upload test ......
ftp -s:%uploadcmdFile% %UploadHost%
del /q %VideoFile%
del /q %downloadcmdFile%
del /q %uploadcmdFile%
:End
pause
資料來源: Myself