[英]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 ? 如何使用批处理文件将图片自动下载到PC的图片部分?
I have already tried looking on Google and have found nothing ! 我已经尝试过在Google上查找内容,却一无所获!
For example, i use a little function in powershell and with a batch file i can download a file like this one : 例如,我在powershell中使用了一个小功能,并使用批处理文件可以下载如下文件:
@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. 这是另一个示例,其中我使用相同的功能从Virustotal.com下载名为VirusTotal Uploader的工具以上传和检查文件。
Check this . 检查一下 。
with bitsadmin : 用bitsadmin:
bitsadmin /transfer myDownloadJob /download /priority normal http://downloadsrv/jpg.jpg "%userprofile%\pictures\jpg.jpg"
with winhttpjs.bat : 与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
每个用户图片目录位于%userprofile%\\pictures
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.