This question is similar to this one: Is it possible to download using the Windows command line?, but with the small difference that, since the browser is the only program allowed to access the internet, it is the only option available. As far as I understand, I would say that the answer is "no way". I tried something like:
"C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe" http://website.com/remotepicture.jpg > ./localfile.jpg
but, unsurprisingly, I got just an empty file.
Then I tried using a local html file, but I got to another dead end related to CORS: still getting an empty file.
<!DOCTYPE html>
<html>
<head>
<META HTTP-EQUIV="Refresh" CONTENT="600">
</head>
<body>
<script>
function forceDownload(blob, filename) {
var a = document.createElement('a');
a.download = filename;
a.href = blob;
document.body.appendChild(a);
a.click();
a.remove();
}
// Current blob size limit is around 500MB for browsers
function downloadResource(url, filename) {
if (!filename) filename = url.split('\\').pop().split('/').pop();
fetch(url, {
headers: new Headers({
'Origin': location.origin
}),
mode: 'no-cors'
})
.then(response => response.blob())
.then(blob => {
let blobUrl = window.URL.createObjectURL(blob);
forceDownload(blobUrl, filename);
})
.catch(e => console.error(e));
}
downloadResource('http://www.klevischer-verein.de/webcam/schwanenturm.jpg');
</script>
</body>
</html>