Can I run an external application from UE4 build?

Hello,

Because my future project will be a 3D platform for customers with many advanced features, I’d like to give them the possibility to run external applications, for example Notepad or something different that is installed in Operating System. Is it possible to have any connection with other standalone applications from an UE4 build? Or for example run exe or small game from Unity?

I have zero experience with this, but FPlatformProcess::CreateProc might be what you’re looking for.

Edit:

FPlatformProcess::CreateProc(TEXT(“C:\Users\\Desktop\Test.exe”), nullptr, true, false, false, nullptr, 0, nullptr, nullptr);

Used that in my code and it worked as expected. Would be nice to have an overload that only required the first parameter, but I’m really happy that it worked so intuitively.

It seems that FPlatformProcess is for Windows only. There’s also FGenericPlatformProcess that works for other platforms, but uses untested code.

Thank you very much for spending your time to solve my problem. I’m a Unity user so UE4 is still an enigma for me :). I have refreshed my C++ knowledge and now I’m going to code in UE4. Running exe from UE4 build is the most important thing in my project, so I’m glad that it is possible.

Regards!

hi! Have you find the way to Running an external .exe from UE4?
I really need to open Kolor Eyes 360 player when my VR experience end.
Kolor eyes have line command so I’m able to create a .bat
Hope it’s possible.
Thank you so much

giovanni bruni

No, I haven’t tested this solution yet. However, I will need running an external .exe from UE4 in the future. Hopefully it’s possible.

Did you get this working…until Unreal can render 360 Videos…need an alternative !!!

(On a side issue does Kolor Eyes work with the CV1 Oculus ?)

Did anyone make any progress with this?

I will really like to know how can I start a dowload from web browser or open a program though a link press in ue4 webrowser widget

This is exactly what I am looking to do as well. I want to be able to open a program inside of Unreal of 360 images that I have created.

I believe this is highly related:
Pre/Post build step in UBT

How on Earth is this related? That article is about running an external program as part of the project build process. The question here is how to execute an external program from a project that is already built.

The post title is confusing. Build could mean a build ( packaged ) or build process.

EDIT: Not an excuse for not reading content though.

Why not just use native C++ functionality?
See for example: http://www.cplusplus.com/reference/cstdlib/system/

Also, you can use platform specific functions which allow for more control, for example with Windows:


#include <iostream>
#include <windows.h>

int main() {
    ShellExecute(NULL, "open", "path\	o\\file.exe", NULL, NULL, SW_SHOWDEFAULT);
}

1 Like

Hi Cultrarius, do you know a similar approach for Android?

Well Android is a bit different in that you do not usually want to directly run some executable. As far as I know, the contract for Android Apps is that they run as a single process. You cannot spawn a new process without breaking that contract. Right now it may run fine on your device, but any update or different OS flavor might cause bugs and crashes.

Use threads and otherwise the native Android functions like intents, activities and whatnot. Have a look at the NDK for more info: Android NDK  |  Android Developers

Hello everybody.

How to run external application from UE4 build “seamless”?
I mean, I want from one UE4 build run another UE4 build, without seeing, how first build quits and another build opens.

What I use so far.

FGenericPlatformProcess::CreateProc. But with that, there is a gap between first and another builds.

delay node. But still, there is a gab. And also, that “another build”, is a lot different builds, so it loads in different time.

put loading screen in “another build” start. That gives smaller “gap”. I create empty map, with just loading screen, with opens level.

**Somehow I fix that “seamless” problem.
**

I just try to communicate between builds. I use StringToFile.

Really waiting for opinion about that. Maybe it was very stupid? :smiley: It solves problem now, but maybe it is better way to do communication between builds.

Hi it works perfectly but ive written it in a C++ Actor script inside the BeginPlay() function. And it opens two windows of my executable. Can you tell me the possible reasons for this? I am very new to Unreal.

Do this inside a “virtual void Init() override;” of a custom GameInstance class, the engine will never run Init() more than once.

It sounds like decompilation of exe file to me.

FMonitoredProcess & FInteractiveProcess