如何更改程序的运行目录 - 通过在exe快捷方式中设置它?

Bic*_*ick 4 java windows directory exe4j

我有一个使用快捷方式运行的exe进程.
在快捷方式的"开始"属性中,我将其设置为所有应用程序资源所在的文件夹.该过程仍然在exe的位置查找文件,而不是在快捷方式中写入的位置.

我也可以在Process Explorer中看到它 - "当前目录"是exe的位置.
有没有办法改变它?

(如果我不够清楚 - 我想将我的应用程序放在一个中央网络位置而不是每个用户文件夹中 - 但我想让它运行 - 在每个用户文件夹上方通过在每个用户文件夹中放置一个快捷方式.)

顺便说一句:为什么我不用代码编写来解决它?因为我的exe中有第三方罐子(我使用exe4j来制作exe)

Jay*_*yan 5

exe4-j文档..,似乎这可以在exe4j项目中配置.

Working directory
For some applications (especially GUI applications) you might want to change the working directory
to a specific directory relative to the executable, for example to read config files that are in a fixed
location. To do so, please select the Change working directory to: checkbox and enter a
directory relative to the executable in the adjacent text field. To change the current directory to the
same directory where the executable is located, please enter a single dot.
Run Code Online (Sandbox Code Playgroud)

  • 正确.更具体地说,取消选择exe4j向导的"可执行文件信息"步骤中的"将工作目录更改为"复选框,然后启动器不会更改工作目录. (3认同)