很多人很讨厌IDEA的右键菜单,或者说很喜欢,但是安装的时候忘记勾选,又不想重新安装,下面一个批处理帮你解决问题
@ECHO OFF&(PUSHD "%~DP0")&(REG QUERY "HKU\S-1-5-19">NUL 2>&1)||(
powershell -Command "Start-Process '%~sdpnx0' -Verb RunAs"&&EXIT)
VER|FINDSTR "5\.[0-9]\.[0-9][0-9]*" > NUL && (
ECHO.&ECHO 当前版本不支持WinXP &PAUSE>NUL&EXIT)
rd/s/q "%AppData%\Open with IntelliJ JDEA" 2>NUL
:MENU
ECHO.&ECHO 1、添加系统右键 Open with IntelliJ JDEA
ECHO.&ECHO 2、删除系统右键 Open with IntelliJ JDEA
IF EXIST "%WinDir%\System32\CHOICE.exe" CHOICE /C 12 /N >NUL 2>NUL
IF EXIST "%WinDir%\System32\CHOICE.exe" IF "%ERRORLEVEL%"=="2" GOTO RemoveMenu
IF EXIST "%WinDir%\System32\CHOICE.exe" IF "%ERRORLEVEL%"=="1" GOTO AddMenu
IF NOT EXIST "%WinDir%\System32\CHOICE.exe" ECHO.&SET /p choice=输入数字项敲回车键:
IF NOT EXIST "%WinDir%\System32\CHOICE.exe" IF NOT "%choice%"=="" SET choice=%choice:~0,1%
IF NOT EXIST "%WinDir%\System32\CHOICE.exe" IF /I "%choice%"=="1" GOTO AddMenu
IF NOT EXIST "%WinDir%\System32\CHOICE.exe" IF /I "%choice%"=="2" GOTO RemoveMenu
IF NOT EXIST "%WinDir%\System32\CHOICE.exe" ECHO.&ECHO 输入无效 &PAUSE&CLS&GOTO MENU
:AddMenu
reg add "HKCR\*\shell\Open with IntelliJ IDEA" /f /v "" /d "Edit with IntelliJ IDEA" >NUL 2>NUL
reg add "HKCR\*\shell\Open with IntelliJ IDEA" /f /v "Icon" /d "%~dp0bin\idea64.exe" >NUL 2>NUL
reg add "HKCR\*\shell\Open with IntelliJ IDEA\command" /f /v "" /d "%~dp0bin\idea64.exe \"%%1\"" >NUL 2>NUL
reg add "HKCR\Directory\shell\IntelliJ IDEA" /f /v "" /d "Open Folder as IntelliJ IDEA Project" >NUL 2>NUL
reg add "HKCR\Directory\shell\IntelliJ IDEA" /f /v "Icon" /d "%~dp0bin\idea64.exe" >NUL 2>NUL
reg add "HKCR\Directory\shell\IntelliJ IDEA\command" /f /v "" /d "%~dp0bin\idea64.exe \"%%1\"" >NUL 2>NUL
reg add "HKCR\Directory\Background\shell\IntelliJ IDEA" /f /v "" /d "Open Folder as IntelliJ IDEA Project" >NUL 2>NUL
reg add "HKCR\Directory\Background\shell\IntelliJ IDEA" /f /v "Icon" /d "%~dp0bin\idea64.exe" >NUL 2>NUL
reg add "HKCR\Directory\Background\shell\IntelliJ IDEA\command" /f /v "" /d "%~dp0bin\idea64.exe \"%%V\"" >NUL 2>NUL
IF EXIST "%WinDir%\System32\CHOICE.exe" (
ECHO.&ECHO 已添加 &TIMEOUT /t 2 >NUL & CLS & GOTO END
) ELSE (
ECHO.&ECHO 已添加,任意键返回 &PAUSE>NUL&GO TO END)
:RemoveMenu
reg delete "HKCR\*\shell\Open with IntelliJ IDEA" /f >NUL 2>NUL
reg delete "HKLM\*\shell\Open with IntelliJ IDEA" /f >NUL 2>NUL
reg delete "HKCR\Directory\shell\IntelliJ IDEA" /f >NUL 2>NUL
reg delete "HKCR\Directory\Background\shell\IntelliJ IDEA" /f >NUL 2>NUL
IF EXIST "%WinDir%\System32\CHOICE.exe" (
ECHO.&ECHO 已删除 &TIMEOUT /t 2 >NUL & CLS & GOTO MENU
) ELSE (
ECHO.&ECHO 已删除,任意键返回 &PAUSE>NUL&CLS&GOTO MENU)
:END
exit
将以上代码另存为bat文件,放在IDEA根目录下用管理员运行,根据需求选择添加还是删除菜单即可。