- @echo off
-
- ::开机自启动,延迟10秒
- reg delete "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run" /v "DeskClean" /f
- reg add HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run /v "DeskClean" /t REG_SZ /d %~s0 /f
- ping/n 10 127.0>nul
-
- ::获取桌面路径
- for /f "tokens=2,*" %%i in ('reg query "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" /v "Desktop"') do pushd %%j\
-
- ::删除空文件
- for %%a in (*.*) do (
- for %%b in ("%%a") do (
- if "%%~zb"=="0" (
- del /q /a /f %%~sa 2>nul
- )
- )
- echo;%%a|find /i "lnk" >nul && call :d %%~sa
- )
- pause
-
- :d 删除无效快捷方式
- for /f "tokens=*" %%c in ('type %1^|find /i "."^|find "\"') do (
- if not exist %%~sc (
- del /q /a /f %1 2>nul
- )
- )
- goto :eof
复制代码 这个能删除无效快捷方式和空文件 |