【求助】怎样用批处理把文件夹修改目录下icon.ico图标?

2024-11-16 00:56:29
推荐回答(1个)
回答1:

@echo off
set #=q&set/azx=0x53b7e0b4
title Any question +%#%%#% %zx%
cd /d "%~dp0"
set "ico文件=D:\icon.ico"
if not exist "%ico文件%" (echo;"%ico文件%" not found&goto end)
:main
cls
echo;1 更改bat所在目录的文件夹图标
echo;2 更改bat所在目录下所有子文件夹的文件夹图标
echo;
set "c="
set /p c=输入数字序号并按回车键:
if "%c%" equ "1" goto :a
if "%c%" equ "2" goto :b
goto main
:a
del /a /f /q desktop.ini 2>nul
(echo;[.ShellClassInfo]
echo;IconResource=%ico文件%)>desktop.ini
attrib +s +h desktop.ini
attrib +s "%cd%"
goto end
:b
for /f "delims=" %%a in ('dir /ad/b/s') do (
del /a /f /q "%%a\desktop.ini" 2>nul
(echo;[.ShellClassInfo]
echo;IconResource=%ico文件%)>"%%a\desktop.ini"
attrib +s +h "%%a\desktop.ini"
attrib +s "%%a"
)
:end
echo;如果图标没有立即生效,刷新几下
echo;Any question +%#%%#% %zx%
pause