网络 - c++上下载文件,Windows下应该调用什么命令行?(或者IE的命令行)
天蓬老师
天蓬老师 2017-04-17 15:05:17
0
3
484

c++上下载文件,Windows下应该调用什么命令行?

天蓬老师
天蓬老师

欢迎选择我的课程,让我们一起见证您的进步~~

reply all(3)
巴扎黑

The Windows cmd does not directly provide users with a dedicated console tool for calling HTTP downloads. If you are calling from a program, you can bring a Windows version executable file of wget or aria2c. There is no need to write HTTP download code.

Can be used in PowerShell 2

$WebClient = New-Object System.Net.WebClient
$WebClient.DownloadFile("https://www.example.com/file","C:\path\file")

PowerShell 3 has the wget statement, which is equivalent to

Invoke-WebRequest -Uri "http://www.example.com" -OutFile "C:\path\file"

However, aria2c is still powerful and can resume interrupted downloads and multi-threaded downloads. Supports HTTP, FTP, BT, magnet links, etc.

刘奇

Why do you use the command line to download? Isn’t it possible to download directly?
It seems to be HTTP protocol. A simple way is to use WinHTTP that comes with Windows. Since it is implemented directly by the kernel, the performance mainly depends on the user. Although if you download it, there will basically be no performance problems. of. . . . There are related discussions on MSDN

https://social.msdn.microsoft...

Here is the official document
https://msdn.microsoft.com/en...

This is much more convenient than handwriting http client using socket.

迷茫

Use Python. Unlike Linux, Windows does not directly provide this kind of support. The other option is to use Power-Shell as mentioned above

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template