::一- for %%a in (3gp aac avi flac flv m4a midi mid mkv mp3 mp4 mpeg mov ts wav rm wmv rmvb mpg) do (
- reg add "HKCR\MPC-BE.%%a\Shell\Open\Command" /f /ve /t REG_SZ /d "\"%~sdp0MPC-BE.exe\" \"%%1\""
- reg add "HKCR\.%%a" /f /ve /t REG_SZ /d "MPC-BE.%%a"
- ) >nul 2>nul
复制代码 ::二- (
- reg add "HKCR\MPC-BE.3gp\DefaultIcon" /f /ve /t REG_SZ /d "\"%~sdp0mpciconlib.dll\",4"
- reg add "HKCR\MPC-BE.aac\DefaultIcon" /f /ve /t REG_SZ /d "\"%~sdp0mpciconlib.dll\",7"
- reg add "HKCR\MPC-BE.avi\DefaultIcon" /f /ve /t REG_SZ /d "\"%~sdp0mpciconlib.dll\",20"
- reg add "HKCR\MPC-BE.flac\DefaultIcon" /f /ve /t REG_SZ /d "\"%~sdp0mpciconlib.dll\",32"
- reg add "HKCR\MPC-BE.flv\DefaultIcon" /f /ve /t REG_SZ /d "\"%~sdp0mpciconlib.dll\",36"
- reg add "HKCR\MPC-BE.m4a\DefaultIcon" /f /ve /t REG_SZ /d "\"%~sdp0mpciconlib.dll\",47"
- reg add "HKCR\MPC-BE.midi\DefaultIcon" /f /ve /t REG_SZ /d "\"%~sdp0mpciconlib.dll\",51"
- reg add "HKCR\MPC-BE.mid\DefaultIcon" /f /ve /t REG_SZ /d "\"%~sdp0mpciconlib.dll\",50"
- reg add "HKCR\MPC-BE.mkv\DefaultIcon" /f /ve /t REG_SZ /d "\"%~sdp0mpciconlib.dll\",53"
- reg add "HKCR\MPC-BE.mp3\DefaultIcon" /f /ve /t REG_SZ /d "\"%~sdp0mpciconlib.dll\",58"
- reg add "HKCR\MPC-BE.mp4\DefaultIcon" /f /ve /t REG_SZ /d "\"%~sdp0mpciconlib.dll\",59"
- reg add "HKCR\MPC-BE.mpeg\DefaultIcon" /f /ve /t REG_SZ /d "\"%~sdp0mpciconlib.dll\",64"
- reg add "HKCR\MPC-BE.mov\DefaultIcon" /f /ve /t REG_SZ /d "\"%~sdp0mpciconlib.dll\",55"
- reg add "HKCR\MPC-BE.ts\DefaultIcon" /f /ve /t REG_SZ /d "\"%~sdp0mpciconlib.dll\",95"
- reg add "HKCR\MPC-BE.wav\DefaultIcon" /f /ve /t REG_SZ /d "\"%~sdp0mpciconlib.dll\",98"
- reg add "HKCR\MPC-BE.rm\DefaultIcon" /f /ve /t REG_SZ /d "\"%~sdp0mpciconlib.dll\",81"
- reg add "HKCR\MPC-BE.wmv\DefaultIcon" /f /ve /t REG_SZ /d "\"%~sdp0mpciconlib.dll\",103"
- reg add "HKCR\MPC-BE.rmvb\DefaultIcon" /f /ve /t REG_SZ /d "\"%~sdp0mpciconlib.dll\",103"
- reg add "HKCR\MPC-BE.mpg\DefaultIcon" /f /ve /t REG_SZ /d "\"%~sdp0mpciconlib.dll\",65"
- ) >nul 2>nul
复制代码 怎么把一和二合起来,就是再添加一个变量比如%%b把二改成reg add "HKCR\MPC-BE.%%a\DefaultIcon" /f /ve /t REG_SZ /d "\"%~sdp0mpciconlib.dll\",%%b"这种形式,%%b是数字,与%%a 的 (3gp aac avi flac flv m4a midi mid mkv mp3 mp4 mpeg mov ts wav rm wmv rmvb mpg)这些一一对应
最终结果,视频播放器MPC-BE的关联批处理,放在与mpciconlib.dll和MPC-BE.exe同级的路径中- @echo off
- fltmc >nul || mshta vbscript:CreateObject("Shell.Application").ShellExecute("%~dpnx0","%*",,"runas",1)(window.close) && exit /b
-
- for %%a in (3gp:4 aac:7 avi:20 flac:32 flv:36 m4a:47 midi:51 mid:50 mkv:53 mov:55 mp3:58 mp4:59 mpeg:64 mpg:65 ts:95 wav:98 wmv:103 rm:81 rmvb:81) do (
- for /f "tokens=1,2 delims=:" %%x in ( "%%a" ) do (
- echo %%x %%y
- reg add "HKCR\MPC-BE.%%x\DefaultIcon" /f /ve /t REG_SZ /d "\"%~sdp0mpciconlib.dll\",%%y"
- reg add "HKCR\MPC-BE.%%x\Shell\Open\Command" /f /ve /t REG_SZ /d "\"%~sdp0MPC-BE.exe\" \"%%1\""
- reg add "HKCR\.%%x" /f /ve /t REG_SZ /d "MPC-BE.%%x"
- )
- ) >nul 2>nul
复制代码
|