getting ghostscript to take in files with spaces in their name (like something in “my documents”)

StackOverflow https://stackoverflow.com/questions/1804646

  •  05-07-2019
  •  | 
  •  

Question

I'm trying to run this command to use ghostscript (from java) but Whether with single quote ' or " or nothing at all I get an error

Error: /undefinedfilename in ('c:\\Documents)


gswin32c.exe -q -dNOPAUSE -sDEVICE=tiffgray -sOutputFile=C:\polter.tiff -r300 'c:\Documents and Settings\polter.pdf' -c quit

any ideas?

Was it helpful?

Solution

use the short names for folders. short names are aliases which are using the 8.3 format. you can find the short name of a folder by using the dir /x command on the command prompt. your path will then look something like this: c:\docume~1\polter.pdf

OTHER TIPS

Break up the arguments yourself:

String[] cmd = {
  "gswin32c.exe",
  "-q", "-dNOPAUSE", "-sDEVICE=tiffgray",
  "-sOutputFile=C:\polter.tiff", "-r300",
  "c:\Documents and Settings\polter.pdf",
  "-c", "quit"
};
Runtime.getRuntime().exec(cmd);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top