两个关于批处理的问题

来源:百度知道 编辑:UC知道 时间:2024/06/02 06:37:45
1.在批处理中怎么让这个命令一直处于监控状态(一直执行到成功为止)?
if exist f:\sss\rr.swf (del f:\sss\uu.swf)
2.怎么让命令在后台执行?

1、
加个时间吧,可以这样写:
@echo off
:go
if exist f:\sss\rr.swf del f:\sss\uu.swf & exit
ping -n 5 127.1>nul
goto go
表示5秒检查1次~~~

2、
(1)同楼上的,
set objShell = CreateObject( WScript.Shell)
a = objShell.Run("d:\loop.bat",0)
(2)高手用,
在批处理前加入以下代码:
实际是调用vbs语言后台运行批处理,只有进程中才看的到.
@echo off
if "%1"=="h" goto begin
start mshta vbscript:createobject("wscript.shell").run("""%~nx0"" h",0)(window.close)&&exit
:begin

3、这个应该是你最终的目的:
@echo off
if "%1"=="h" goto begin
start mshta vbscript:createobject("wscript.shell").run("""%~nx0"" h",0)(window.close)&&exit
:begin
:go
if exist f:\sss\rr.swf del f:\sss\uu.swf & exit
ping -n 5 127.1>nul
goto go

嘿嘿,如果对你有帮助,加点飞哦。。。<