如何创建批处理文件

软件发布|下载排行|最新软件

当前位置:首页IT学院IT百科

如何创建批处理文件

  2022-11-02 我要评论

批处理文件是扩展名为.bat 或.cmd的文本文件,包含一条或多条命令,可以快速地进行批量处理。它使用方便、灵活,功能强大,自动化程度高。那么它是如何创建的呢?下面为大家简单介绍一个“清除系统垃圾文件”的批处理文件的创建。PS:下图是批处理文件创建前后的图标变化。

操作方法

  • 01

    在桌面鼠标依次右键——>新建——>文本文档;

  • 02

    在记事本中输入命令:@echo off echo 正在清除系统垃圾文件,请稍等...... del /f /s /q %systemdrive%\*.tmp del /f /s /q %systemdrive%\*._mp del /f /s /q %systemdrive%\*.log del /f /s /q %systemdrive%\*.gid del /f /s /q %systemdrive%\*.chk del /f /s /q %systemdrive%\*.old del /f /s /q %systemdrive%\recycled\*.* del /f /s /q %windir%\*.bak del /f /s /q %windir%\prefetch\*.* rd /s /q %windir%\temp & md %windir%\temp del /f /q %userprofile%\cookies\*.* del /f /q %userprofile%\recent\*.* del /f /s /q "%userprofile%\Local Settings\Temporary Internet Files\*.*" del /f /s /q "%userprofile%\Local Settings\Temp\*.*" del /f /s /q "%userprofile%\recent\*.*" echo 清除系统垃圾完成! echo. & pause

  • 03

    依次点击文件——>另存为;

  • 04

    将文件扩展名改为.bat,然后点击确定保存即可。双击创建好的批处理文件即可清除系统垃圾!

特别提示

保存时将文件扩展名改为.bat或者.cmd都可以。

Copyright 2022 版权所有 软件发布 访问手机版

声明:所有软件和文章来自软件开发商或者作者 如有异议 请与本站联系 联系我们