::设置右键菜单.cmd
::需要管理员权限运行
@echo off&(pushd "%~dp0")&(reg query "HKU\S-1-5-19">nul 2>&1)||(powershell -Command "Start-Process '%~sdpnx0' -Verb RunAs"&&exit/b)

set QRCP_BIN=%~dp0
set QRCP_CON=%QRCP_BIN:\=_%

::设置qrcp窗口大小，刚好能放下二维码
reg add HKEY_CURRENT_USER\Console\%QRCP_CON%qrcp.exe /v ScreenColors /t REG_DWORD /d 0xf5 /f>nul 2>nul
reg add HKEY_CURRENT_USER\Console\%QRCP_CON%qrcp.exe /v ScreenBufferSize /t REG_DWORD /d 0x1d003b /f>nul 2>nul
reg add HKEY_CURRENT_USER\Console\%QRCP_CON%qrcp.exe /v WindowSize /t REG_DWORD /d 0x1d003b /f>nul 2>nul

::文件添加右键菜单
reg add HKEY_CLASSES_ROOT\*\shell\QRCP /ve /d QRCP传输 /f>nul 2>nul
reg add HKEY_CLASSES_ROOT\*\shell\QRCP /v icon /d "%QRCP_BIN%qrcp.exe,0" /f>nul 2>nul
reg add HKEY_CLASSES_ROOT\*\shell\QRCP\command /ve /d """"%QRCP_BIN%qrcp.exe""" -q -k -w 0 """%%1"""" /f>nul 2>nul
 
::文件夹添加右键菜单
reg add HKEY_CLASSES_ROOT\Directory\shell\QRCP /ve /d QRCP传输 /f>nul 2>nul
reg add HKEY_CLASSES_ROOT\Directory\shell\QRCP /v icon /d "%QRCP_BIN%qrcp.exe,0" /f>nul 2>nul
reg add HKEY_CLASSES_ROOT\Directory\shell\QRCP\command /ve /d """"%QRCP_BIN%qrcp.exe""" -q -k -w 2请扫码下载 -z """%%v"""" /f>nul 2>nul
 
::文件夹背景处添加右键菜单
reg add HKEY_CLASSES_ROOT\Directory\Background\shell\QRCP /ve /d QRCP接收 /f>nul 2>nul
reg add HKEY_CLASSES_ROOT\Directory\Background\shell\QRCP /v icon /d "%QRCP_BIN%qrcp.exe,0" /f>nul 2>nul
reg add HKEY_CLASSES_ROOT\Directory\Background\shell\QRCP\command /ve /d """"%QRCP_BIN%qrcp.exe""" receive -q -k -w 1请扫码上传 -o """%%v"""" /f>nul 2>nul

echo               QRCP右键菜单设置完毕
echo ================================================
echo 分享文件，在文件或文件夹上右键菜单点击'QRCP传输'
echo 接收文件，在文件夹空白处右键菜单点击'QRCP接收'
echo.
echo.
pause