views:

56

answers:

2

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?

+2  A: 

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

Adrien Plisson
You are cleverer than I. Great and simple solution, +1!
Carl Smotricz
What about arguments with spaces that are not paths?
Greg Bacon
+1  A: 

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);
Greg Bacon