Skip to content

Instantly share code, notes, and snippets.

@pypykim
Created June 2, 2014 14:44
Show Gist options
  • Select an option

  • Save pypykim/564d98233b0fca8c29f1 to your computer and use it in GitHub Desktop.

Select an option

Save pypykim/564d98233b0fca8c29f1 to your computer and use it in GitHub Desktop.
ftp1.bat
@echo off
echo PLEASE WAIT...
mkdir d:\test
echo ftpuser> d:\test\temp.ftp
echo 123456>> d:\test\temp.ftp
echo lcd d:\test>> d:\test\temp.ftp
echo get test.zip>> d:\test\temp.ftp
echo bye>> d:\test\temp.ftp
ftp -s:d:\test\temp.ftp 172.31.10.194 > d:\test\output.txt
find /i " KB/s)" d:\test\output.txt
if errorlevel 1 goto MB
find /i " MB/s)" d:\test\output.txt
if errorlevel 1 goto KB
goto error
:KB
set range=KB/s
for /f "tokens=3 delims= " %%a in ('find /i "KB/s)" d:\test\output.txt') do set speed=%%a
set speed=%speed:~1,4%
goto next
:MB
set range=MB/s
for /f "tokens=3 delims= " %%a in ('find /i "MB/s)" d:\test\output.txt') do set speed=%%a
set speed=%speed:~1,4%
goto next
:error
echo Your speed cannot be detected!
goto end
:next
cls
echo Your speed is: %speed% %range%
echo.
pause
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment