回答:
PowerShellでスクリプトの実行を許可し、atと入力します。 cmd
管理者として実行:
セレクトピン cmd
押す シフト + 右マウスクリック
powershell -command "Set-ExecutionPolicy RemoteSigned"
デスクトップにPdfConvertフォルダを作成し、実行します Pdf2Docx4.cmd
Pdf2Docx4.cmd:
powershell .\PdfConvert\Pdf2Docx4.ps1
Pdf2Docx4.ps1:
$TypeExt="docx"
$closeDocParam = $true;
$PDFpath = "D:\VBS\PS-29-AcrobatProX\"
Get-ChildItem -Filter *.pdf |Where {
# logical document
$AVDoc = New-Object -ComObject AcroExch.AVDoc;
$AVDoc.Open($_.Fullname, "") | Out-Null;
# physical document
$PDDoc = $AVDoc.GetPDDoc();
$JavaScriptObject = $PDDoc.GetJSObject();
# get the bridge JavaScript Object
$T = $JavaScriptObject.GetType();
$T.InvokeMember("SaveAs",
[Reflection.BindingFlags]::InvokeMethod -bor `
[Reflection.BindingFlags]::Public -bor `
[Reflection.BindingFlags]::Instance ,
$null,
$JavaScriptObject,
@([IO.Path]::ChangeExtension($_.Fullname, $TypeExt), ("com.adobe.acrobat."+$TypeExt)));
$T.InvokeMember("closeDoc",
[Reflection.BindingFlags]::InvokeMethod -bor `
[Reflection.BindingFlags]::Public -bor `
[Reflection.BindingFlags]::Instance ,
$null,
$JavaScriptObject,
$closeDocParam) | Out-Null;
$PDDoc.Close() | Out-Null;
$AVDoc.Close(1) | Out-Null;
}