[UE4]虛幻UE4 .uproject文件無關聯 右鍵菜單少了

前一段時間由於一些事,重裝系統  而後從新安裝UE4跟VS  ,忽然發現。。。居然以前的UE4原先的項目找不到了,而後用UE4打開就提示git

「該文件沒有與之關聯的程序來執行該操做,請先安裝一個程序。。。」shell

發現右鍵 .uproject 的菜單欄選項不見了,折騰了一下弄回來了ui

刪除註冊表this

  1. ctrl+r 輸入 regegit 調出註冊表
  2. 刪除 HKEY_CLASSES_ROOT 下的 .uproject

 

新建一個文本文檔,而後更名爲  UnrealProjectMenuRegistration.cmd,腳本源碼在下面spa

:: 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>code

@ECHO OFFblog

echo.
echo Locating where Unreal Engine is installed by checking the Windows registry...token

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%get

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\

  1. 右鍵管理員權限運行該腳本

  2. done,項目文件 .uproject 的右鍵菜單欄選項 回來了

相關文章
相關標籤/搜索