[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
返回列表 发帖
写了个粗糙的
  1. #ANSI编码&cls&powershell -Version 5.1 -NoLogo -NoProfile "gc '%~0'|out-string|iex"&pause&exit
  2. dir -Directory | %{
  3.     $n = (dir ($_.Name + '.*'))[0]
  4.     $f = gc -Encoding UTF8 $n | Out-String
  5.     cd $_
  6.     if ($f -match 'UniqueCode="(.*?)"') {
  7.         ..\7za.exe a ..\tmp.zip ('-p' + $Matches[1]) * | Out-Null
  8.     } else {
  9.         ..\7za.exe a ..\tmp.zip * | Out-Null
  10.     }
  11.     cd ..
  12.     $b = [System.Convert]::ToBase64String((gc .\tmp.zip -Encoding Byte -Raw))
  13.     $utf8NoBom = New-Object System.Text.UTF8Encoding($false)
  14.     [System.IO.File]::WriteAllText($n, ($f -replace 'Value=""', ('Value="{0}"' -f $b)), $utf8NoBom)
  15.     rm .\tmp.zip
  16. }
复制代码

TOP

回复 9# 304802301


    把../7za.exe改成字符串以后,需要在开头加上&
  1. & "c:\xxx\7za.exe" a ...
复制代码
另外,压缩率或其他地方不一样,生成的base6就不一样

TOP

  1. #ANSI编码&cls&powershell -Version 5.1 -NoLogo -NoProfile -Command "gc -Encoding Oem -ReadCount 0 -LiteralPath '%~f0'|out-string|iex"&pause&exit/b
  2. dir -Directory | %{
  3.     $n = (dir -File ($_.Name + '.*'))[0]
  4.     $f = gc -Encoding UTF8 -Raw $n
  5.     cd $_
  6.     if ($f -match 'UniqueCode="(.*?)"') {
  7.         $p = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($Matches[1]))
  8.         & "D:\7za.exe" a ..\tmp.zip ('-p' + $p) * | Out-Null
  9.     } else {
  10.         & "D:\7za.exe" a ..\tmp.zip * | Out-Null
  11.     }
  12.     cd ..
  13.     $b = [System.Convert]::ToBase64String((gc .\tmp.zip -Encoding Byte -Raw))
  14.     $utf8NoBom = New-Object System.Text.UTF8Encoding($false)
  15.     [System.IO.File]::WriteAllText($n, ($f -replace 'Value=""', ('Value="{0}"' -f $b)), $utf8NoBom)
  16.     rm .\tmp.zip
  17. }
复制代码
楼上大佬写的更好,我抄了一点 ,密码改用了解码后的

TOP

返回列表