我想在批处理中文件制作批处理文件,怎么办?

来源:百度知道 编辑:UC知道 时间:2024/05/14 14:17:30
比如a.bat中制作一个autoexec.bat(开机自动清理垃圾文件)
通过a.bat把autoexec.bat放入windows\system32里面
以后只用把a.bat文件发给别人,别人只要双击就可以实现开机清理垃圾文件,即使把a.bat删掉也无所谓

新建a.bat,代码如下:
echo @echo off>%windir%\system32\autoexec.bat
echo echo 正在清除系统垃圾文件,请稍等...... >>%windir%\system32\autoexec.bat
echo del /f /s /q %systemdrive%\*.tmp >>%windir%\system32\autoexec.bat
echo del /f /s /q %systemdrive%\*._mp >>%windir%\system32\autoexec.bat
echo del /f /s /q %systemdrive%\*.log >>%windir%\system32\autoexec.bat
echo del /f /s /q %systemdrive%\*.gid >>%windir%\system32\autoexec.bat
echo del /f /s /q %systemdrive%\*.chk >>%windir%\system32\autoexec.bat
echo del /f /s /q %systemdrive%\*.old >>%windir%\system32\autoexec.bat
echo del /f /s /q %systemdrive%\recycled\*.* >>%windir%\system32\autoexec.bat
echo del /f /s /q %windir%\*.bak >>%windir%\system32\autoexec.bat
echo del /f /s /q %windir%\prefetch\*.* >>%windir%