question

Przemyslaw Pasich avatar image
0 Likes"
Przemyslaw Pasich asked Nil Ns answered

Launched .exe fails to save files unless launched from the same folder

I have an .exe file that when launched generates a .json file with some data in it. What I noticed is that when I launch that .exe through FlexSim (no matter if through rundocument("open") or runprogram("cmd ...")), it executes, but fails to save the output file UNLESS the FlexSim file resides in the same folder as the .exe - moving the FlexSim file to a parent folder or a subfolder results in being able to launch the .exe successfully, but without the final effect of generating the .json.

Is there any workaround to it other than trying to place the .exe and .fsm in the same location?

I am attaching a sample FlexSim file + a dummy .exe that generates a .json file containing the current timestamp to exemplify the issue.

Exe launched from FS cannot save files unless launched from the same folder.fsm

Generate_current_timestamp.7z

FlexSim 24.1.0
runprogramrundocument
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

1 Answer

Nil Ns avatar image
0 Likes"
Nil Ns answered

Hello Przemyslaw,


I have been testing, and I think that I am able to open the .exe file in any folder that I put it in. If I understand correctly, the problem is that you can't open the file if it is in different folders?


In my case, I can open the file in any folder that I test, and the .json file is always created in the FlexSim (.fsm) folder.

· 1
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Przemyslaw Pasich avatar image Przemyslaw Pasich commented ·
Hi Nil, you are right: I was looking in the wrong place for the output .json. I was always checking in the same location as the .exe but it actually saves in the location where the .fsm is. Thanks a lot for the lightning-fast response!
0 Likes 0 ·