# 下载 Calibre , 找到 ebook-convert.exe
$app = ".\ebook-convert.exe" # ebook-convert.exe 路径
$root = ".\epub\" # 电子书路径
Get-ChildItem "$root\*.epub" | % FullName | % {
$newPath = [System.IO.Path]::ChangeExtension($_, ".mobi")
if (-not [System.IO.File]::Exists($newPath))
{
& $app $_ $newPath
if (-not $?)
{
throw [System.ApplicationException]::new("文件 $_ 转换失败")
}
}
}