简体   繁体   中英

Download a file from a batch file

How would I auto download a picture onto my PC using a batch file into the pictures section of my PC ?

I have already tried looking on Google and have found nothing !

For example, i use a little function in powershell and with a batch file i can download a file like this one :

@echo off
Set "URL=http://www.kcc.edu/campaigns/PublishingImages/poh.jpg"
Set "File=%USERPROFILE%\Pictures\Hello.png"
Call :Download "%URL%" "%File%"
Start "" "%File%"
exit
::**********************************************************************************
:Download <url> <File>
Powershell.exe -command "(New-Object System.Net.WebClient).DownloadFile('%1','%2')"
exit /b
::********************************************************************************** 

Here is another example where i used the same function to download the tool called VirusTotal Uploader from Virustotal.com to upload and check files.

Scan_Registry_Virustotal.bat

Check this .

with bitsadmin :

bitsadmin /transfer myDownloadJob /download /priority normal http://downloadsrv/jpg.jpg "%userprofile%\pictures\jpg.jpg"

with winhttpjs.bat :

call winhhtpjs.bat https://example.com/files/jpg.jpg -saveTo "%userprofile%\pictures\jpg.jpg"

Each users pictures directory is located in %userprofile%\\pictures

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM