Java ProcessBuilder with multiple params with spaces

前端 未结 1 1673
栀梦
栀梦 2021-01-20 17:10

I know that there is a lot of solved questions regarding executing processes from java.But I am unable to solve my problem using answers provided. I am trying go create post

1条回答
  •  深忆病人
    2021-01-20 17:51

    Since pg_dump.exe is an exe (not a .bat) you don't need the cmd at all, and it is probably causing more problems than it solves. Just call the exe directly, and remove the extra set of quotes around the file paths:

    new String[]{"D:\\PostgreSQL 8.2\\bin\\pg_dump.exe","-U","usr","-i",
      "-h","localhost","-p","5432","-F","c","-b",
      "-f","D:\\backup test\\backups\\test_27-1-2013_210.backup", "test"}
    

    0 讨论(0)
提交回复
热议问题