【问题标题】:NSIS - Set the working directory for a process before running itNSIS - 在运行之前设置进程的工作目录
【发布时间】:2011-12-28 11:37:23
【问题描述】:

如上。 我专门通过调用 java.exe 并传递类名来使用 ExecWait 运行 Java 程序。我正在运行的应用程序依赖于相对路径并且必须从特定目录运行,但是当我直接调用 java 时,它只是将安装程序位置用作当前目录并失败。

有没有办法解决这个问题?

更新:这是我的命令行:

ExecWait "$INSTDIR\MyApp\jre\bin\java.exe -cp $INSTDIR\MyApp\lib\*; MyJavaClassName"

【问题讨论】:

  • 你能发布一些命令行吗?
  • 完成,我只是在调用我的应用程序的捆绑 JRE 以及类名。
  • 为了安全起见,你应该修正你的引号:ExecWait '"$instdir\app.exe" "param 1" param2 "para m3"' (路径等应该被引用)

标签: java process nsis


【解决方案1】:

SetOutPath为进程设置当前/工作目录,它应该被子进程继承...

Push $OUTDIR
SetOutPath $myspecialdir
ExecWait '"$instdir\myapp.exe"'
Pop $OUTDIR
SetOutPath $OUTDIR # Optional if working directory does not matter for the rest of the code

SetOutPath $myspecialdir
ExecWait '"$instdir\myapp.exe"'
SetOutPath $instdir

【讨论】:

  • 谢谢,我不知道这也会设置当前目录:)
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2011-02-18
  • 2011-01-23
  • 1970-01-01
  • 2020-10-16
  • 2012-01-09
  • 2013-09-13
  • 2013-08-01
相关资源
最近更新 更多