SORU
3 EKİM 2008, Cuma


Uyuyan bir toplu iş dosyası

Windows, bir kutuya bir şey otomatikleştirme için bir toplu iş dosyası yazarken, birkaç saniye (genellikle test/döngü başlatmak için bir süreç bekliyor bekle) yürütme duraklatmak için ihtiyacım olmadı. Zaman, bulabildiğim en iyi çözüm ping (ben çocuk değil) istenen etkiyi elde etmek için kullanır. Bir daha okumak için bir çağrı açıklar here, "bekle buldum."aşağıdaki gibi uygulanmaktadır . bat

@ping 127.0.0.1 -n 2 -w 1000 > nul
@ping 127.0.0.1 -n %1% -w 1000> nul

O zaman bekle bir telefon görüşmesi vardır.kendi toplu bat, saniye sayısını uyumak için geçen dosya.

11* *(sonunda!). Bizler hala Windows XP kullanan bu arada, Windows ya da (ne yazık ki) 2000 Windows NT, orada daha iyi bir yolu var mı?

Eğer herhangi bir argüman komut satırında geçirilen ikinci bir varsayılan böylece accepted answer sleep.py senaryo değiştirilmiş:

import time, sys

time.sleep(float(sys.argv[1]) if len(sys.argv) > 1 else 1)

CEVAP
30 Mart 2011, ÇARŞAMBA


timeout komutu Vista itibaren kullanılabilir.

c:\> timeout /?

TIMEOUT [/T] timeout [/NOBREAK]

Description:
    This utility accepts a timeout parameter to wait for the specified
    time period (in seconds) or until any key is pressed. It also
    accepts a parameter to ignore the key press.

Parameter List:
    /T        timeout       Specifies the number of seconds to wait.
                            Valid range is -1 to 99999 seconds.

    /NOBREAK                Ignore key presses and wait specified time.

    /?                      Displays this help message.

NOTE: A timeout value of -1 means to wait indefinitely for a key press.

Examples:
    TIMEOUT /?
    TIMEOUT /T 10
    TIMEOUT /T 300 /NOBREAK
    TIMEOUT /T -1

Not: giriş yönlendirme ile önemsiz örnek: çalışmıyor

C:\>echo 1 | timeout /t 1 /nobreak
ERROR: Input redirection is not supported, exiting the process immediately.

Bunu Paylaş:
  • Google+
  • E-Posta
Etiketler:

YORUMLAR

SPONSOR VİDEO

Rastgele Yazarlar

  • BigDawsVlogs

    BigDawsVlogs

    17 HAZİRAN 2013
  • Official Clouds

    Official Clo

    1 HAZİRAN 2011
  • PaysNatalAu's channel

    PaysNatalAu'

    11 Aralık 2010