[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
返回列表 发帖
本帖最后由 went 于 2020-10-22 23:06 编辑

保存成test.bat
和pr6n.txt放到一起运行,图片保存在word文件夹中
  1. @cd /d "%~dp0" & mkdir "word" >nul 2>nul & powershell -c "Get-Content '%~0' | Select-Object -Skip 1 | Out-String | Invoke-Expression" & pause&exit
  2. [void][System.Reflection.Assembly]::LoadWithPartialName("System.Web")
  3. $Script:xhr=New-Object -ComObject "MSXML2.ServerXMLHTTP"
  4. $Script:count=0
  5. function Download-Image($key){
  6. $name = '{0:X4}' -f ([int]$key[0])
  7.     if(Test-Path (".\word\"+$name+".png") -ErrorAction SilentlyContinue){
  8.         Write-Host ("skip download: .\word\"+$name+".png")
  9.         return
  10.     }
  11. $png = [System.IO.File]::Create(".\word\"+$name+".png")
  12.     $url = "https://penji-gakushu.com/shop/font/preview/d/?font_id=33&str="+[System.Web.HttpUtility]::UrlEncode($key)+"&size=220&bg=ffffff&font=000000"
  13. $Script:xhr.abort()
  14.     $Script:xhr.open("GET",$url,$false)
  15.     $Script:xhr.send()
  16.     if($Script:xhr.status -ne 200) {   
  17.             Write-Host ("failed:"+$Script:xhr.status+" "+$Script:xhr.statusText) -ForegroundColor Red
  18.             $png.Dispose()
  19.             return
  20.     }
  21.     $bytes = $Script:xhr.responseBody
  22.     $png.Write($bytes,0,$bytes.Count)
  23.     $png.Name
  24.     $png.Dispose()
  25. $Script:count += 1
  26.     [System.Console]::Title = "" + $Script:count
  27. }
  28. Get-Content "pr6n.txt" -Encoding UTF8 | foreach { Download-Image -key $_.Trim() }
复制代码

TOP

回复 3# vance

win7这个我也不会弄,你只有等其它高人了

TOP

返回列表