批处理判断文件并执行一些操作
来源:百度知道 编辑:UC知道 时间:2024/07/04 22:50:29
批处理写下面一段代码:
if D:\111.TXT文件是否存在
存在就修改111.TXT为222.TXT
接着启动D:\333.EXE程序
endif
if D:\111.TXT文件是否存在
存在就修改111.TXT为222.TXT
接着启动D:\333.EXE程序
endif
@echo off
if exist D:\111.TXT (rename d:\111.txt 222.txt)
start d:\333.exe
exit
这个不是很难,你可以在“命令解释器”(cmd.exe)输入(if /?)进行了解.
直接
RENAME 111.TXT 22.TXT
IF NOT ERRORLEVEL
D:\333.EXE
@echo off
if exist D:\111.txt (
ren 111.txt 222.txt
D:\333.exe
)
if NOT exist goto end
ren d:\111.txt 222.txt
start d:\333.exe
:end