如何使用批处理文件从 Unreal Engine.uproject 文件生成 Visual Studio 项目文件?

How to Generate Visual Studio Project Files from Unreal Engine .uproject file with a batch file?

我有一个如下的批处理文件来清理我的 UE 项目。

del *.sln
rmdir /s /q .vs
rmdir /s /q Binaries
rmdir /s /q Intermediate
rmdir /s /q Saved
rmdir /s /q DerivedDataCache
"C:\Program Files (x86)\Epic Games\Launcher\Engine\Binaries\Win64\UnrealVersionSelector.exe" /projectfiles Attaching.uproject

不幸的是,当我运行批处理时,出现如下错误:

我通过逆向工程找到了批处理中的最后一个命令,如下所示:

问题

从批处理文件生成 Visual Studio 项目文件的正确方法是什么?

在浪费了很多时间之后,我找到了解决办法。我们必须完全限定项目路径。

echo off

del *.sln
rmdir /s /q .vs
rmdir /s /q Binaries
rmdir /s /q Intermediate
rem rmdir /s /q Saved
rmdir /s /q DerivedDataCache


set MyUVS="C:\Program Files (x86)\Epic Games\Launcher\Engine\Binaries\Win64\UnrealVersionSelector.exe"
set MyUBT="f:\Program Files\Epic Games\UE_4.26\Engine\Binaries\DotNET\UnrealBuildTool.exe"

rem change Transformation to your own project name
set MyFullPath="%cd%\Transformation"


%MyUVS% /projectfiles %MyFullPath%.uproject

%MyUBT% Development Win64 -Project=%MyFullPath%.uproject -TargetType=Editor -Progress -NoEngineChanges -NoHotReloadFromIDE

%MyFullPath%.uproject

%MyFullPath%.sln

我希望这个答案对以后的其他人也有用!