是否有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