Eric Guo's blog.cloud-mes.com

Hoping writing JS, Ruby & Rails and Go article, but fallback to DevOps note

One Line to Pack Individual PDF File Into Their BaseName.RAR in PowerShell

Permalink

gci *.pdf | % {iex $("rar mf -m5 -rr1 {0}.rar '{1}'" -f $($_.BaseName -replace "\s+","."),$_.Name)}

Here is some explain:

  • gci is Alias of Get-ChildItem
  • iex is Alias of Invoke-Expression
  • rar is the execution file which default locate at C:\Program Files\WinRAR

Comments