1. 程式人生 > >powershell 2.0 下載 bootcdn 資源

powershell 2.0 下載 bootcdn 資源

thp files java serialize cti ron 2.0 item false

powershell 2.0 , win 7 以上操作系統可用。

[System.Reflection.Assembly]::LoadWithPartialName("System.Web.Extensions")

$path = "D:\front\"
$library = "element-ui"

$json = "[]"
$json = $client.DownloadString("https://api.bootcdn.cn/libraries/"+ $library +".json")
$ser = New-Object System.Web.Script.Serialization.JavaScriptSerializer
$obj = $ser.DeserializeObject($json) ##$info = ConvertFrom-Json -InputObject $json if($obj.assets.length){ $array = $obj.assets[0].files $version = $obj.assets[0].version $client = new-object System.Net.WebClient foreach ($src in $array){ $url = "https://cdn.bootcss.com/"+ $library +"
/" + $version +"/" + $src $des = ( $path + $library + "@" + $version +"/" + $src ).replace("/", "\") if((Test-Path $des.Substring(0,$des.LastIndexOf(‘\‘)) ) -eq $False) { New-Item $des.Substring(0,$des.LastIndexOf(‘\‘)) -type directory } $client.DownloadFile($url,$des) } }

powershell 2.0 下載 bootcdn 資源