webstorm添加右键批处理文件(.bat)

新建一个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
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Dawn·张

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值