Search code examples
command-line-argumentspostscript

passing filename with spaces to pstotxt3.exe


I have an exe which convert postscript file to text now the problem is when input file name contain spaces it says "GPL Ghostscript 9.00: Unrecoverable error, exit code 1" but no problem when output file contains no spaces. I am running the following command in a bat file

pstotxt3.exe -bboxes -output "2dh 21za1.1jp.ps.pstotext.txt" "2dh 21za1.1jp.ps"

where 2dh 21za1.1jp.ps.pstotext.txt is the output file name and 2dh 21za1.1jp.ps is the input file name


Solution

  • Try double quoting the input filename. I'm not familiar with pstotxt3, but it looks like it is running GS as a separate process, and passing the input filename as a command line parameter. The " marks on the command line to pstotxt3 get stripped by the command processor, so when GS see the filename it thinks they are multiple switches.

    So I'd suggest: pstotxt3.exe -bboxes -output "2dh 21za1.1jp.ps.pstotext.txt" ""2dh 21za1.1jp.ps""

    But that's merely a guess. Can you post the complete error please ?