@echo off cd %userprofile%\Desktop dir /b /o:g > tmp.txt

REM Create temporary file to store sorted list echo. > sorted.txt

REM Sort the desktop items by type for /f 'tokens=*'' %%a in (tmp.txt) do ( for /f 'tokens=2 delims= '' %%b in ('assoc '%%a'') do ( echo '%%b %%a' >> sorted.txt ) )

REM Sort the list in place sort /r sorted.txt > sorted.tmp

REM Create a new batch file for renaming echo @echo off > rename.bat

REM Rename the desktop items in the sorted order for /f 'tokens=2,*'' %%a in (sorted.tmp) do ( echo rename '%%b' '%%a' >> rename.bat )

REM Execute the rename batch file call rename.bat

REM Clean up temporary files del tmp.txt del sorted.txt del rename.bat

echo Desktop has been sorted by item type.

Windows 7 桌面文件类型排序批处理代码

原文地址: https://www.cveoy.top/t/topic/cdWw 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录