问题
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?
回答1:
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
回答2:
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);
来源:https://stackoverflow.com/questions/1804646/getting-ghostscript-to-take-in-files-with-spaces-in-their-name-like-something-i