本帖最后由 kli2018 于 2020-7-2 13:28 编辑
如题- @echo off
- PUSHD %~dp0
-
- echo.
- echo 1.为常用图片格式文件添加右键打开
- echo.
- echo 2.删除
- echo.
- set /p file=请选择?(1/2):
- if "%file%"=="1" goto ql1
- if "%file%"=="2" goto ql2
-
- :ql1
- for /f "tokens=2 delims==" %%a in ('assoc .bmp') do set "pictype=%%a"
- call :addright
- for /f "tokens=2 delims==" %%a in ('assoc .gif') do set "pictype=%%a"
- call :addright
- for /f "tokens=2 delims==" %%a in ('assoc .ico') do set "pictype=%%a"
- call :addright
- for /f "tokens=2 delims==" %%a in ('assoc .jpg') do set "pictype=%%a"
- call :addright
- for /f "tokens=2 delims==" %%a in ('assoc .jpe') do set "pictype=%%a"
- call :addright
- for /f "tokens=2 delims==" %%a in ('assoc .jpeg') do set "pictype=%%a"
- call :addright
- for /f "tokens=2 delims==" %%a in ('assoc .png') do set "pictype=%%a"
- call :addright
- goto :EOF
-
- :ql2
- for /f "tokens=2 delims==" %%a in ('assoc .bmp') do set "pictype1=%%a"
- call :deleteright
- for /f "tokens=2 delims==" %%a in ('assoc .gif') do set "pictype1=%%a"
- call :deleteright
- for /f "tokens=2 delims==" %%a in ('assoc .ico') do set "pictype1=%%a"
- call :deleteright
- for /f "tokens=2 delims==" %%a in ('assoc .jpg') do set "pictype1=%%a"
- call :deleteright
- for /f "tokens=2 delims==" %%a in ('assoc .jpe') do set "pictype1=%%a"
- call :deleteright
- for /f "tokens=2 delims==" %%a in ('assoc .jpeg') do set "pictype1=%%a"
- call :deleteright
- for /f "tokens=2 delims==" %%a in ('assoc .png') do set "pictype1=%%a"
- call :deleteright
- goto :EOF
-
- :addright
- Reg.exe add "HKLM\SOFTWARE\Classes\%pictype%\shell\open1" /v "Icon" /t REG_SZ /d "%CD%\FSViewer.exe,0" /f
- Reg.exe add "HKLM\SOFTWARE\Classes\%pictype%\shell\open1" /ve /t REG_SZ /d "FSViewer" /f
- Reg.exe add "HKLM\SOFTWARE\Classes\%pictype%\shell\open1\command" /ve /t REG_SZ /d "\"%CD%\FSViewer.exe\" \"%%1\"" /f
- goto :EOF
-
- :deleteright
- Reg.exe delete "HKLM\SOFTWARE\Classes\%pictype1%\shell\open1" /f
- goto :EOF
复制代码
|