Hi,
we want to shutdown a PC from a command within the unreal engine. (Its for an installation)
Is there a way to start a shutdown.bat from blueprints?
Maybe a plugin?
Thanks
Hi,
we want to shutdown a PC from a command within the unreal engine. (Its for an installation)
Is there a way to start a shutdown.bat from blueprints?
Maybe a plugin?
Thanks
This is not possible in blueprints, however you can use the following C++ function:
FPlatformProcess::CreateProc(TEXT("C:\\Users\\Example\\Desktop\\Example.exe"), nullptr, true, false, false, nullptr, 0, nullptr, nullptr);
âFPlatformProcess::CreateProcâ only seems to work with .exe. How do we use it to launch .bat?
If this doesnât work, then you might need to use a platform specific approach. For example, if using Windows, you can use system("C:\\Users\\Example\\Desktop\\Example.bat");
no good; it errors.
FPlatformProcess::CreateProc(TEXT system(âC:\Program Files\7-Zip\tester.batâ), nullptr, true, false, false, nullptr, 0, nullptr, nullptr);
No, system
is a function in the Windows C++ API. I recommend working on your C++ before moving to a colossal framework such as Unreal. If youâre not comfortable working with C++, then Iâm sure there are plenty of people willing to whip up a small plugin for you.
Lol, this forum is venom! No wounder not many use it. I assure you i know more about c++ and ue than you. When you post a comments in an attempt to answer someoneâs question please be sure to give a full and complete answer. When you learn how to do that then maybe one day you, and or others, will have what it takes and be able to make that small c++ plugin for me.
Wow. I offered to help you, replied to your comments where many others wouldnât, provided a clear directive (Documentation about the Windows API and UE4 is plentiful), and you come off and call me out and tell me, with no previous knowledge, that you know more C++. Tell me, whoâs more toxic here, me, or you? Did I come off as hostile towards you? I told you that you might need to work on your C++ because you put a function inside a string of another functionâŚ
That was extremely uncalled for, itâs not hard to sustain communication without resorting to hostility.
Thatâs allot of words. Please always write full and complete answer to peoples questions. It will make the c++ part of the UE4 forum more productive and useful for all. That is how it works.
Thanks,
Appreciate that you didnât lash out. I donât frequent these forums but do help out when I have nothing else to do.
Letâs indeed tune it down a notch.
Windows has a shutdown.exe command which can be used with
FPlatformProcess::ExecProcess(*(FullPathToExe.ToString()), nullptr, false, false, false);
Where FullPathToExe is an FText containing the full path + arguments to the shutdown.exe command.
wow, IT is a great methord . I just met the same trouble. IT is solved by your methord, thank you very much
I found a cool plugin. The â.bat Extensionâ.