Цитата volk1234:
тип файла должен быть application а не текст »
|
а это вариант
Код:
@Echo Off
SetLocal EnableExtensions
Set KBFile1=WindowsServer2003-KB967715-x86-ENU.exe
Set KB_Url1=http://download.microsoft.com/download/1/A/2/1A234937-9572-408D-ACC9-3F99915CAC67/%KBFile1%
CALL :GET_PROXY
CALL :GET_FILE "%KBFile1%" "%KB_Url1%"
EXIT
:GET_FILE
<Nul Set /P XYZ=Testing Connection...
curl -f -s -I "%~2" %$X%|Find " 200 OK" >Nul
If ErrorLevel 1 Echo ERROR [Not Responding]& Exit /B 1
For /F "Skip=1 Tokens=1* Delims=: " %%i In (
'curl -f -s -I "%~2" %$X%') Do Set %%i=%%j
If /I "%Content-Type%"=="application/octet-stream" (
Echo OK [%Content-Length% Bytes] ) Else Echo ERROR [Wrong Response]& Exit /B 2
Echo Downloading "%~1"...
curl -f -# -O "%~2" %$X%
If Not Exist "%~1" Echo ERROR [Download not starting].& Exit /B 3
For %%i In ("%~1") Do (
If %%~zi EQU %Content-Length% Echo File Download Successfully!& Exit /B 0)
Echo ERROR [Download interrupted abnormally]
Exit /B 4
:GET_PROXY
Set $X=&Set $R=HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings
For /F "Tokens=1,3" %%i In ('REG Query "%$R%"^|Find "Proxy"') Do Set %%i=%%j
If "%ProxyEnable%"=="0x1" Set $X=-x %ProxyServer%
GoTo :EOF