[UE4]虚幻UE4 .uproject文件无关联 右键菜单少了
前一段时间因为一些事,重装系统 然后重新安装UE4跟VS ,突然发现。。。竟然之前的UE4原先的项目找不到了,然后用UE4打开就提示
“该文件没有与之关联的程序来执行该操作,请先安装一个程序。。。”
发现右键 .uproject 的菜单栏选项不见了,折腾了一下弄回来了
删除注册表
- ctrl+r 输入 regegit 调出注册表
- 删除 HKEY_CLASSES_ROOT 下的 .uproject
新建一个文本文档,然后改名为 UnrealProjectMenuRegistration.cmd,脚本源码在下面
:: UnrealProjectMenuRegistration.cmd
::
:: This batch file will try to find where the Unreal Engine is installed, then update your registry
:: to register the Unreal Project File type (and its right click menu for things such as generating
:: Visual Studio project files, and launching)
::
:: Run as an Administrator, as it's required for writing to HKLM.
::
:: Author: David Moore <david@sadrobot.co.nz>
@ECHO OFF
echo.
echo Locating where Unreal Engine is installed by checking the Windows registry...
FOR /F "tokens=2*" %%A IN ('reg query "HKLM\SOFTWARE\EpicGames\Unreal Engine" /v "INSTALLDIR"') DO (
SET "UnrealEngineDir=%%B"
)
IF "%UnrealEngineDir%"=="" GOTO CannotFindUnrealEngine
echo.
echo Using Unreal Engine directory: %UnrealEngineDir%
set LauncherPath=%UnrealEngineDir%Launcher\Engine\Binaries\Win64\UnrealVersionSelector.exe
echo.
echo Adding registry keys for the Unreal Project right click menu...
:: HKLM\SOFTWARE\Classes\.uproject
reg ADD "HKLM\Software\Classes\.uproject" /ve /d Unreal.ProjectFile /f
IF ERRORLEVEL 1 (
echo Couldn't write to registry. Did you forget to run this batch file as an administrator?
goto TheEnd
)
:: HKLM\SOFTWARE\Classes\Unreal.ProjectFile
reg ADD "HKLM\Software\Classes\Unreal.ProjectFile" /ve /d "Unreal Engine Project File" /f
:: HKLM\SOFTWARE\Classes\Unreal.ProjectFile\DefaultIcon
reg ADD "HKLM\Software\Classes\Unreal.ProjectFile\DefaultIcon" /ve /d "\"%LauncherPath%\"" /f
:: HKLM\SOFTWARE\Classes\Unreal.ProjectFile\shell\open
reg ADD "HKLM\Software\Classes\Unreal.ProjectFile\shell\open" /ve /d "Open" /f
reg ADD "HKLM\Software\Classes\Unreal.ProjectFile\shell\open\command" /ve /d "\"%LauncherPath%\" /editor \"%%1\"" /f
:: HKLM\SOFTWARE\Classes\Unreal.ProjectFile\shell\run
reg ADD "HKLM\Software\Classes\Unreal.ProjectFile\shell\run" /ve /d "Launch game" /f
reg ADD "HKLM\Software\Classes\Unreal.ProjectFile\shell\run" /v Icon /t REG_SZ /d "\"%LauncherPath%\"" /f
reg ADD "HKLM\Software\Classes\Unreal.ProjectFile\shell\run\command" /ve /d "\"%LauncherPath%\" /game \"%%1\"" /f
:: HKLM\SOFTWARE\Classes\Unreal.ProjectFile\shell\rungenproj
reg ADD "HKLM\Software\Classes\Unreal.ProjectFile\shell\rungenproj" /ve /d "Generate Visual Studio project files" /f
reg ADD "HKLM\Software\Classes\Unreal.ProjectFile\shell\rungenproj" /v Icon /t REG_SZ /d "\"%LauncherPath%\"" /f
reg ADD "HKLM\Software\Classes\Unreal.ProjectFile\shell\rungenproj\command" /ve /d "\"%LauncherPath%\" /projectfiles \"%%1\"" /f
:: HKLM\SOFTWARE\Classes\Unreal.ProjectFile\shell\switchversion
reg ADD "HKLM\Software\Classes\Unreal.ProjectFile\shell\switchversion" /ve /d "Switch Unreal Engine version..." /f
reg ADD "HKLM\Software\Classes\Unreal.ProjectFile\shell\switchversion" /v Icon /t REG_SZ /d "\"%LauncherPath%\"" /f
reg ADD "HKLM\Software\Classes\Unreal.ProjectFile\shell\switchversion\command" /ve /d "\"%LauncherPath%\" /switchversion \"%%1\"" /f
:Done
echo.
echo Done.
echo.
goto TheEnd
:CannotFindUnrealEngine
echo.
echo DOH! Can't find the Unreal Engine.
echo.
goto TheEnd
:TheEnd
pause
修改脚本
注释掉下面这一段代码
FOR /F "tokens=2*" %%A IN ('reg query "HKLM\SOFTWARE\EpicGames\Unreal Engine" /v "INSTALLDIR"') DO (
SET "UnrealEngineDir=%%B"
)
在注释的代码后加入一行,直接设置 启动器路径(C:\Program Files (x86)\Epic Games\,如果是安装选择的其它路径请自行选择)
SET UnrealEngineDir=C:\Program Files (x86)\Epic Games\
-
右键管理员权限运行该脚本
-
done,项目文件 .uproject 的右键菜单栏选项 回来了