Download the software through the command line under Windows, and it is more convenient to use the "ftp" command. The main reason is that there is no Linux command "wget" under Windows, but although cmd cannot be implemented, PowerShell is no problem. This article uses PowerShell to complete the operation of command-line file download, which can broaden the coverage of command-line downloads. In the deployment templates in Microsoft Private Cloud and Hyper-V, you will always come across the day when you use it.
$client = New-Object "System.Net.WebClient" $client. DownloadFile("http://www.maytide.net/info.txt","D:info.txt") The first sentence is to define a class The second sentence is to download through xxx, provide the download address, and then save the address locally. But obviously, such a long English character is difficult to remember === PowerShell is too complicated====== We save the code below as aa.ps1
The code looks like it's 4 lines, isn't it more complicated? It's actually simpler. Users can run "PowerShell .aa.ps1 download address local address" under CMD. $args can pass input parameters, the above example uses to directly pass parameters when running the script, and after completing this script, it is easy to download it later. If it is running under PowerShell, it is ".aa.ps1 download address local address" The specific effect is shown in the figure below
This script does not verify errors, only wants to be fast. Big brothers, this is already very simple, if you want it to be too complicated, it is really hopeless.
|