China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-08-08 01:26
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » There is a problem with the batch file that loops ping and displays the current time View 1,456 Replies 8
Original Poster Posted 2007-01-23 04:20 ·  中国 上海 联通
新手上路
Credits 6
Posts 2
Joined 2007-01-23 00:20
19-year member
UID 77369
Gender Male
Status Offline
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!
Floor 2 Posted 2007-01-23 11:35 ·  中国 湖北 武汉 电信
版主
★★★★★
Credits 11,386
Posts 4,938
Joined 2006-07-23 17:10
20-year member
UID 59080
Status Offline

  I tested it, there's no problem...
Floor 3 Posted 2007-01-23 22:32 ·  中国 上海 联通
新手上路
Credits 6
Posts 2
Joined 2007-01-23 00:20
19-year member
UID 77369
Gender Male
Status Offline
:(I'm using Windows XP SP2. Is it related to the system? What version are you using?
Floor 4 Posted 2007-01-24 00:46 ·  中国 湖北 武汉 电信
版主
★★★★★
Credits 11,386
Posts 4,938
Joined 2006-07-23 17:10
20-year member
UID 59080
Status Offline
I'm also using Windows XP sp2 pro edition.
Floor 5 Posted 2007-01-24 11:07 ·  中国 湖南 衡阳 电信
中级用户
★★
Credits 322
Posts 144
Joined 2007-01-10 13:00
19-year member
UID 76062
Gender Male
Status Offline
You copy this BAT file and then try opening it.
Floor 6 Posted 2007-05-23 20:32 ·  中国 重庆 长寿区 电信
初级用户
Credits 101
Posts 47
Joined 2007-04-18 16:05
19-year member
UID 85634
Gender Male
Status Offline
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
Floor 7 Posted 2007-05-25 22:03 ·  中国 江苏 苏州 电信
中级用户
★★
Credits 238
Posts 98
Joined 2007-04-10 07:50
19-year member
UID 84593
Gender Male
From 陕西
Status Offline
Expert, indeed, you cannot name a file ping.bat.
一切皆有可能!我行!我能!
Floor 8 Posted 2008-04-03 15:55 ·  中国 广东 东莞 博路电信科技公司
新手上路
Credits 6
Posts 3
Joined 2008-03-05 17:04
18-year member
UID 112110
Gender Male
Status Offline
Just want to detect status anomalies such as packet loss and then give a prompt, how to write this?
Floor 9 Posted 2008-04-04 11:38 ·  中国 河南 郑州 联通
初级用户
Credits 35
Posts 17
Joined 2008-04-03 01:33
18-year member
UID 114814
Gender Male
Status Offline
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.
Forum Jump: