How to run unreal external files

I tried it, but ‘File not found’ is displayed.
The file’s permissions are ‘read and execute’.

image

LogSlate: Took 0.000299 seconds to synchronously load lazily loaded font ‘…/…/…/Engine/Content/Slate/Fonts/Roboto-Light.ttf’ (167K)
LogSlate: Took 0.002815 seconds to synchronously load lazily loaded font ‘…/…/…/Engine/Content/Slate/Fonts/Roboto-Italic.ttf’ (157K)
LogSlate: Took 0.001025 seconds to synchronously load lazily loaded font ‘…/…/…/Engine/Content/Slate/Fonts/Roboto-BoldCondensed.ttf’ (158K)
LogTemp: Warning: Is File Exists: “S:/ELECCOM/Vision/OPENCV/Bettle9/Battle9Rounds v1.15-4/TargetzoneBattle9Rounds.exe”
LogTemp: Error: File Isn’t Exists: “S:/ELECCOM/Vision/OPENCV/Bettle9/Battle9Rounds v1.15-4/TargetzoneBattle9Rounds.exe”
LogBlueprintUserMessages: [W_OpenTest_C_0] File not found

// Ob_test1.cpp


#include "Ob_test1.h"
#include "Runtime/Core/Public/HAL/PlatformProcess.h"

// 파일을 실행하고 결과를 반환하는 함수
FString UOb_test1::ExecuteFileAtPath(const FString& FilePath, const FString& Params)
{
    UE_LOG(LogTemp, Warning, TEXT("Is File Exists: %s"), *FilePath);
    if (FPaths::FileExists(FilePath))
    {
        UE_LOG(LogTemp, Warning, TEXT("File Exists: %s"), *FilePath);

        FProcHandle ProcHandle = FPlatformProcess::CreateProc(*FilePath, *Params, true, false, false, nullptr, 0, nullptr, nullptr);
        if (ProcHandle.IsValid())
        {
            UE_LOG(LogTemp, Warning, TEXT("File Run: %s"), *FilePath);
        }
        else
        {
            UE_LOG(LogTemp, Error, TEXT("File Run Failed: %s. Please check if the file requires administrative privileges."), *FilePath);
        }


    }
    else
    {
        UE_LOG(LogTemp, Error, TEXT("File Isn't Exists: %s"), *FilePath);
        return TEXT("File not found");
    }

    
    return FilePath;
}

Try to replace the space in “Battle9Rounds v1.15-4” with an underscore, i saw other people running into that issue with space name in file path.

1 Like