中国DOS联盟论坛

China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
Guest | Log in | Register | Members | Search | China DOS Union
中国DOS联盟论坛
The time now is 2026-08-08 00:35
48,041 topics / 350,128 posts / today 3 new / 48,253 members
DOS批处理 & 脚本技术(批处理室) » There is a problem with the batch file that loops ping and displays the current time
Printable Version  1,455 / 8
Floor1 zhangsiqiang Posted 2007-01-23 04:20
新手上路 Posts 2 Credits 6
Little brother just started learning batch processing commands and encountered a problem when writing a batch file, so he asks you, big shots, for help.

The batch file is as follows:

@echo off
:MM
echo %time%,%date% >>log.txt
PING 127.1 >>log.txt

PING 127.1 |FIND /I "Reply from"
IF %errorlevel%==0 GOTO :MM
ECHO 

After double-clicking to run, an error prompt appears: The process cannot access the file because it is being used by another process.

Thank you everyone first!
Floor2 lxmxn Posted 2007-01-23 11:35
版主 Posts 4,938 Credits 11,386

  I tested it, there's no problem...
Floor3 zhangsiqiang Posted 2007-01-23 22:32
新手上路 Posts 2 Credits 6
:(I'm using Windows XP SP2. Is it related to the system? What version are you using?
Floor4 lxmxn Posted 2007-01-24 00:46
版主 Posts 4,938 Credits 11,386
I'm also using Windows XP sp2 pro edition.
Floor5 bob1989 Posted 2007-01-24 11:07
中级用户 Posts 144 Credits 322
You copy this BAT file and then try opening it.
Floor6 chkau Posted 2007-05-23 20:32
初级用户 Posts 47 Credits 101
Hahaha, I was looking for posts related to ping and accidentally came across this post. Why did you set the name of this bat file as ping.bat? Hahaha
Floor7 acme Posted 2007-05-25 22:03
中级用户 Posts 98 Credits 238 From 陕西
Expert, indeed, you cannot name a file ping.bat.
Floor8 jewel Posted 2008-04-03 15:55
新手上路 Posts 3 Credits 6
Just want to detect status anomalies such as packet loss and then give a prompt, how to write this?
Floor9 knightak Posted 2008-04-04 11:38
初级用户 Posts 17 Credits 35
Learned something again: The name of the BAT file you write yourself should preferably not be the same as the name of the system-built tool.
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023