首页 > 解决方案 > Visual Studios PowerShell 将 PDF 转换为 TIF 文件夹路径需要双 \\

问题描述

将 my 转换.pdf为 a时.tif,我可以在正确的文件夹中获得输出的唯一方法是\\手动输入 double 有没有一种方法可以将这些已经放入我选择的文件夹中

转换.pdf.tif下面的代码 *这不是我的,只是为了适合我

#Path to your Ghostscript EXE

$tool = "C:\\Program Files\\gs\\gs9.52\\bin\\gswin64c.exe"

#Directory containing the PDF files that will be converted
$inputDir = $textbox2.Text

#Output path where the TIF files will be saved
$outputDir = $textbox3.Text

$pdfs = get-childitem $inputDir -recurse | where {$_.Extension -match "pdf"}

foreach($pdf in $pdfs)
{
    $tif = $outputDir + $pdf.BaseName + ".tif"
    if(test-path $tif)
    {
       $tif
    }
    else        
    {   
        'Processing ' + $pdf.Name        
        $param = "-sOutputFile=$tif"
        & $tool -q -dNOPAUSE -sDEVICE=tiff24nc $param -r300 $pdf.FullName -c quit 
    }

}
}

在此处输入图像描述

如您所见,Tif 文件夹具有我需要的路径布局

标签: powershellvisual-studio-2019

解决方案


推荐阅读