是否有Windows命令将文件从http url复制或下载到文件系统?我尝试过复制,xcopy和robocopy,他们似乎不支持http url。使用http的Windows文件副本
3
A
回答
7
您可以使用powershell脚本来完成此操作。
获取的Web http://www.msn.com/ -toFile www.msn.com.html
function Get-Web($url,
[switch]$self,
$credential,
$toFile,
[switch]$bytes)
{
#.Synopsis
# Downloads a file from the web
#.Description
# Uses System.Net.Webclient (not the browser) to download data
# from the web.
#.Parameter self
# Uses the default credentials when downloading that page (for downloading intranet pages)
#.Parameter credential
# The credentials to use to download the web data
#.Parameter url
# The page to download (e.g. www.msn.com)
#.Parameter toFile
# The file to save the web data to
#.Parameter bytes
# Download the data as bytes
#.Example
# # Downloads www.live.com and outputs it as a string
# Get-Web http://www.live.com/
#.Example
# # Downloads www.live.com and saves it to a file
# Get-Web http://wwww.msn.com/ -toFile www.msn.com.html
$webclient = New-Object Net.Webclient
if ($credential) {
$webClient.Credential = $credential
}
if ($self) {
$webClient.UseDefaultCredentials = $true
}
if ($toFile) {
if (-not "$toFile".Contains(":")) {
$toFile = Join-Path $pwd $toFile
}
$webClient.DownloadFile($url, $toFile)
} else {
if ($bytes) {
$webClient.DownloadData($url)
} else {
$webClient.DownloadString($url)
}
}
}
0
我不记得任何命令行工具。 也许你可以实现类似的使用JavaScript(与WinHttpRequest)的东西,这样的运行它:
wscript your_script.js
,或只与wget的安装MSYS。
4
我不熟悉Windows上的任何可以执行此操作的命令,但我总是在Windows上为此目的下载GNU wget。
1
cURL想到的。
curl -o homepage.html http://www.apptranslator.com/
该命令下载页面并将其存储到文件homepage.html中。 提供数千个选项。
0
只需使用Win32 API的(1行的C代码...)
+1
你可以发布哪个API? – 2010-07-02 19:52:26
1
使用BITSAdmin Tool(的bitsadmin是Windows上的命令行实用程序)
例如:
bitsadmin /transfer "Download_Job" /download /priority high "http://www.sourceWebSite.com/file.zip" "C:\destination\file.zip"
Download_Job - 你想要的任何相关工作名称
相关问题
- 1. 获取Qt使用本机Windows副本文件部件
- 2. 使用autohotkey脚本的Windows文件副本
- 3. Windows注册表文件影子副本
- 4. 文本文件的副本
- 5. 使用长文件名副本
- 6. 使用PHP取下CSV文件副本
- 7. 我可以使用Windows窗体控件的多个副本吗?
- 8. 如何在OpenFileDialog控件中选择文件的副本副本
- 9. 创建文件的文件副本
- 10. 文件夹和文件的副本
- 11. 上次修改Windows批处理脚本副本文件
- 12. 如何使用git比较工作副本,临时副本和已提交副本的文件
- 13. 什么是比Windows默认更好的文件副本?
- 14. 基于格式的Windows批处理文件副本,“FILENAME_20131220.txt.pgp”
- 15. 如何使用Windows CMD将文件名的副本保存为空白文本文档?
- 16. 伪雾S3文件副本
- 17. 文件副本更新
- 18. 文件夹副本VC++
- 19. PHP海量文件副本
- 20. 蚂蚁副本文件夹
- 21. C#:文件副本通知
- 22. 使Subversion使用工作副本中已有的文件
- 23. 复制文本文件并用输出文本填充副本
- 24. WatchFolder事件上的副本文件
- 25. 使文件夹树没有文件的副本
- 26. 检查HTTP服务器上的文件是否与本地副本不同
- 27. 使用shell脚本创建多个文件副本
- 28. 使用MongoVUE的副本集
- 29. Windows批处理文件复制并保留副本
- 30. Android的副本文件不工作的本地SQLite文件
太棒了!我已将ssh cmd更改为powershell,并且运行良好。 – Pablote 2009-03-03 19:45:57