Windows 2000说超时不是命令或批处理文件 [英] Windows 2000 says that timeout isn't a command or batch file

查看:164
本文介绍了Windows 2000说超时不是命令或批处理文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在搞弄CMD,并制作动画ascii艺术.我一直在尝试在Windows 2000笔记本电脑上使用超时"命令,但是,每次尝试这样做时,它只是表明它不是内部或外部命令或批处理文件.

I've just been messing around with CMD, and making animated ascii art. I've been attempting to use the Timeout command on my Windows 2000 laptop, however every time I attempt this, it just says it isn't an internal or external command or batch file.

这是在运行Windows 2000的旧东芝3110CT笔记本电脑上;我从某个旧货店拿到它.我已经在Windows 10笔记本电脑上进行了尝试,并且代码在该笔记本电脑上运行得很好,但是2000笔记本电脑是我的编码笔记本电脑,如果要放在那里,我会很喜欢.

This is on an old Toshiba 3110CT laptop running Windows 2000; I got it from a thrift store at some point. I've tried this on my Windows 10 laptop, and the code works perfectly fine there, but the 2000 laptop is my coding laptop, and I would like it if it were on there.

@echo off
cd %SystemRoot%\system32\
timeout.exe /t 1 /nobreak >nul

我希望它等待一秒钟,然后显示我的ascii动画的下一帧.相反,它只是告诉我 'timeout.exe'无法识别为内部或外部命令,可操作程序或批处理文件."

I expect for it to wait for a second, and then display the next frame of my ascii animation. Instead, it just tells me that "'timeout.exe' is not recognized as an internal or external command, operable program or batch file."

推荐答案

根据本文timeout仅在从Vista开始的Windows的家庭版本中引入.因此,在Windows 2000上无法使用timeout(但

According to this article, timeout was only introduced on home versions of Windows starting with Vista. As such, using timeout won't work on Windows 2000 (but will work in Windows Server 2000).

如果您仍然需要等待批处理,则可以使用此具有漏洞的ping调用使批处理等待指定的时间(以毫秒为单位).

If you're still in need of making the batch wait, you can use this hacky ping call to make the batch wait for a set amount of time in milliseconds.

要让您的批处理等待1秒钟,请执行以下操作:

To make your batch wait for 1 second, do this:

ping 127.255.255.255 -n 1 -w 1000 >nul

说明:

  • 127.255.255.255本地环回地址,并用于(在至少在Windows中),专门用于广播目的.对该地址的任何请求都不会重新发送到客户端计算机.
  • -n [number]表示命令应尝试ping此地址的次数,在这种情况下为1次.
  • -w [number]表示命令在超时之前应等待响应的时间(以毫秒为单位),在这种情况下为1000毫秒.
  • >nul使输出从stdout重定向为null,因此ping命令的实际输出不会显示在命令提示符下.如果您想变得超级安全,还可以通过在末尾添加2>nul将输出从stderr重定向为null.
  • 127.255.255.255 is a local loopback address and is used (at least in Windows) specifically for broadcast purposes. Any requests made to this address won't get retransmitted to the client machine.
  • -n [number] denotes the number of times that the command should try to ping this address, in this case, 1 time.
  • -w [number] denotes the amount of time in milliseconds that the command should wait for a response before timing out, in this case, 1000 milliseconds.
  • >nul makes the output redirect from stdout to null, as such the actual output from the ping command won't show on your command prompt. If you wanted to be super safe, you could also redirect the output from stderr to null as well by adding 2>nul at the end.

这篇关于Windows 2000说超时不是命令或批处理文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆