新建一个webstorm右键注册.bat,把下面的直接复制进去 (注意:webstorm的地址根据自己的改一下)
:: Check for administrative privileges
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
if '%errorlevel%' NEQ '0' (
echo Requesting administrative privileges...
goto UACPrompt
) else ( goto AdminAccess )
:UACPrompt
echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
echo UAC.ShellExecute "cmd.exe", "/c ""%~f0""", "", "runas", 1 >> "%temp%\getadmin.vbs"
"%temp%\getadmin.vbs"
del "%temp%\getadmin.vbs"
exit /B
:AdminAccess
REM Step 01: Navigate to HKEY_CLASSES_ROOT\Directory\shell and create a new key named "WebStorm"
reg add "HKEY_CLASSES_ROOT\*\shell\WebStorm" /f
REM Step 02: Set the default value of the "WebStorm" key to "Open Folder as WebStorm Project"
reg add "HKEY_CLASSES_ROOT\*\shell\WebStorm" /ve /d "Open as WebStorm" /f
REM Step 03: Create a new string value named "Icon" with the path to WebStorm executable
reg add "HKEY_CLASSES_ROOT\*\shell\WebStorm" /v "Icon" /d "C:\Users\10915\AppData\Local\Programs\WebStorm\bin\webstorm64.exe" /f
REM Step 04: Create a new key named "command" under "WebStorm"
reg add "HKEY_CLASSES_ROOT\*\shell\WebStorm\command" /f
REM Step 05: Set the default value of the "command" key to the command to open WebStorm with the folder
reg add "HKEY_CLASSES_ROOT\*\shell\WebStorm\command" /ve /d "\"C:\Users\10915\AppData\Local\Programs\WebStorm\bin\webstorm64.exe\" \"%%V\"" /f
REM Step 11: Navigate to HKEY_CLASSES_ROOT\Directory\shell and create a new key named "WebStorm"
reg add "HKEY_CLASSES_ROOT\Directory\shell\WebStorm" /f
REM Step 12: Set the default value of the "WebStorm" key to "Open Folder as WebStorm Project"
reg add "HKEY_CLASSES_ROOT\Directory\shell\WebStorm" /ve /d "Open Folder as WebStorm Project" /f
REM Step 13: Create a new string value named "Icon" with the path to WebStorm executable
reg add "HKEY_CLASSES_ROOT\Directory\shell\WebStorm" /v "Icon" /d "C:\Users\10915\AppData\Local\Programs\WebStorm\bin\webstorm64.exe" /f
REM Step 14: Create a new key named "command" under "WebStorm"
reg add "HKEY_CLASSES_ROOT\Directory\shell\WebStorm\command" /f
REM Step 15: Set the default value of the "command" key to the command to open WebStorm with the folder
reg add "HKEY_CLASSES_ROOT\Directory\shell\WebStorm\command" /ve /d "\"C:\Users\10915\AppData\Local\Programs\WebStorm\bin\webstorm64.exe\" \"%%V\"" /f
REM Step 21: Navigate to HKEY_CLASSES_ROOT\Directory\shell and create a new key named "WebStorm"
reg add "HKEY_CLASSES_ROOT\Directory\Background\shell\WebStorm" /f
REM Step 22: Set the default value of the "WebStorm" key to "Open Folder as WebStorm Project"
reg add "HKEY_CLASSES_ROOT\Directory\Background\shell\WebStorm" /ve /d "Open Folder as WebStorm Project" /f
REM Step 23: Create a new string value named "Icon" with the path to WebStorm executable
reg add "HKEY_CLASSES_ROOT\Directory\Background\shell\WebStorm" /v "Icon" /d "C:\Users\10915\AppData\Local\Programs\WebStorm\bin\webstorm64.exe" /f
REM Step 24: Create a new key named "command" under "WebStorm"
reg add "HKEY_CLASSES_ROOT\Directory\Background\shell\WebStorm\command" /f
REM Step 25: Set the default value of the "command" key to the command to open WebStorm with the folder
reg add "HKEY_CLASSES_ROOT\Directory\Background\shell\WebStorm\command" /ve /d "\"C:\Users\10915\AppData\Local\Programs\WebStorm\bin\webstorm64.exe\" \"%%V\"" /f
echo Registry keys have been successfully created.
pause