本帖最后由 zaqmlp 于 2020-10-9 12:15 编辑
回复 9# vance - <# :
- cls
- @echo off
- cd /d "%~dp0"
- powershell -NoProfile -ExecutionPolicy bypass "Invoke-Command -ScriptBlock ([ScriptBlock]::Create([IO.File]::ReadAllText('%~f0',[Text.Encoding]::Default))) -Args '%~f0'"
- for /f "tokens=1,2 delims=|" %%a in ('type "%tmp%\url.txt"') do (
- echo;"%%b"
- curl.exe "%%a" -o "%%b"
- echo;
- )
- pause
- exit
- #>
- $txtfile=".\pr6n.txt";
- $newfolder=".\result";
-
- $self=get-item -liter $args[0];
- $path=$self.Directory.FullName;
- $txtfile=$txtfile -replace '^\.',$path;
- $newfolder=$newfolder -replace '^\.',$path;
- if(-not (test-path -liter $txtfile)){Write-host ('"'+$txtfile+'" not found');exit;};
- if(-not (test-path -liter $newfolder)){[void](md $newfolder)};
-
- $tmpfile=($env:tmp)+'\url.txt';[System.Collections.ArrayList]$u=@();
- [void][Reflection.Assembly]::LoadWithPartialName('System.Web');
- $text=[IO.File]::ReadAllLines($txtfile,[Text.Encoding]::UTF8);
- for($i=0;$i -lt $text.count;$i++){
- $word=[Web.HttpUtility]::UrlEncode($text[$i],[Text.Encoding]::UTF8);
- [byte[]] $b=[Text.Encoding]::GetEncoding('UTF-32').GetBytes($text[$i]);
- $uc='';
- for($k=3;$k -ge 0;$k--){
- $t=[Convert]::ToString($b[$k], 16).PadLeft(2,'0');
- $uc=$uc+$t;
- };
- $uc=$uc -replace '^(00){1,}','';
- $url='https://penji-gakushu.com/shop/font/preview/d/?font_id=33&str='+$word.toUpper()+'&size=220&bg=ffffff&font=000000';
- $pngfile=$newfolder+'\'+$uc+'.png';
- $line=$url+'|'+$pngfile;
- [void]$u.add($line);
- };
- [IO.File]::WriteAllLines($tmpfile,$u,[Text.Encoding]::GetEncoding('GB2312'));
复制代码
|