RT,我想直接把文件夹拖到bat上运行,直接生成图标
研究了3个晚上,弄了个像点样子东西
但是如果文件名里有非ANSI编码的字符输出的ini就变成“?”了
有什么解决方法吗- @echo off
- cd /d %1
- ::
- set "ico=%~1"
- >>desktop.ini echo.[.ShellClassInfo] >>desktop.ini
- setlocal enabledelayedexpansion
- >>desktop.ini echo.IconResource=!ico!\#.ico,0
- endlocal
- >>desktop.ini echo.[ViewState]
- >>desktop.ini echo.Mode=
- >>desktop.ini echo.Vid=
- >>desktop.ini echo.FolderType=Pictures
- attrib desktop.ini +s +h
- attrib -r %1 /d
- attrib +r %1 /d
- ::
- echo 图标生成完成
- ::
- attrib -s -h %1/desktop.ini
- set add=%~dp1
- for /f "delims=" %%a in (desktop.ini) do (
- set str=%%a
- setlocal enabledelayedexpansion
- set str=!str:%add%=..\!
- echo !str!>>1.ini
- endlocal
- )
- move 1.ini desktop.ini
- attrib +s +h %1/desktop.ini
- attrib +s +h %1/#.ico
- attrib -r %1 /d
- attrib +r %1 /d
- ::
- pause
复制代码
|