|
bat修改指定文件夹图标(3则)
一、指定DLL中图标为文件夹图标.bat:
=================================
@echo OFF
SET "目录=D:\新建文件夹"
CALL :DIRICON "%目录%"
exit
GOTO :EOF
::结束
:DIRICON DIR
ATTRIB -H -S -R "%~1\DESKTOP.INI"
(
ECHO,[.ShellClassInfo]
ECHO,IconFile=%%SystemRoot%%\system32\SHELL32.dll
ECHO,IconIndex=-237%_这是音乐文件夹图标_%
)>"%~1\DESKTOP.INI"
ATTRIB +H +S "%~1\DESKTOP.INI"
::ATTRIB -R %1
ATTRIB +R %1
::====================
::【刷新】【检测(是否在PE中运行),是向下,否到:Q】
if not exist "X:\windows\" goto :Q
X:\Windows\System32\Pecmd.exe kill explorer & start X:\Windows\explorer.exe
start "" "D:\"
exit
:Q
taskkill /f /im explorer.exe & start C:\Windows\explorer.exe >nul 2>nul
start "" "D:\"
exit
二、指定ico为文件夹图标.bat:
===========================
@ECHO OFF
SET 图标0=%~dp0碎片.ico
SET 目录1=D:\新建文件夹
::====================
::【设置:目录1图标】
CALL :DIRICON "%目录1%"
exit
GOTO :EOF
:DIRICON DIR
ATTRIB -H -S -R "%~1\DESKTOP.INI"
(ECHO,[.ShellClassInfo]
ECHO,IconFile=%图标0%
ECHO,IconIndex=0)>"%~1\DESKTOP.INI"
ATTRIB +H +S "%~1\DESKTOP.INI"
ATTRIB +R %1
::====================
::【刷新】【检测(是否在PE中运行),是向下,否到:Q】
if not exist "X:\windows\" goto :Q
X:\Windows\System32\Pecmd.exe kill explorer & start X:\Windows\explorer.exe
start "" "D:\"
exit
:Q
taskkill /f /im explorer.exe & start C:\Windows\explorer.exe >nul 2>nul
start "" "D:\"
exit
三、设置文件夹图标(拖).bat:
===========================
title 修改文件夹图标
if "%~f1"=="" echo 本目录的 【图标文件(*.ico)或者(*.exe)】拖拽到 批处理图标上 & goto :m
if "%~x1"==".ico" goto :g
if "%~x1"==".exe" goto :g
goto :m
:g
echo [.ShellClassInfo] >"%~dp1desktop.ini"
echo IconIndex=0 >>"%~dp1desktop.ini"
echo IconFile=%~nx1 >>"%~dp1desktop.ini"
cd /d %~dp1
attrib "%cd%" +s
goto :z
:m
pause>nul
:z
|
|