bat限制太多了,想试试powershell- @echo off
- :loop
- if "%~1"=="" goto :done
- if not exist "%~1\*.ico" goto :err
- del "%~1\desktop.ini" /f /q /ah 1>nul 2>nul
- set "dir=%~1"
- pushd "%dir%"
- for /f "delims=" %%a in ('dir /a-d/b *.ico') do set "icon=%%~nxa"
- (echo [.ShellClassInfo]
- echo IconResource=%icon%
- echo [ViewState]
- echo Mode=
- echo Vid=
- echo FolderType=Pictures
- )>"%dir%\desktop.ini"
- attrib +s +h "%dir%\desktop.ini"
- attrib +s +h "%icon%"
- attrib +r /d "%dir%"
- popd
- goto :next
- :err
- echo;找不到文件 - %~nx1
- :next
- shift
- goto :loop
- :done
- echo;
- pause
复制代码
|