cuteOriginally Posted by бубенчиков
![]()
Учись, студент.Originally Posted by химик
Putting those batch commands to sleep...
Funny ... just when you think the whole world knows about some thing, you find out that ain't always the case.
Someone asked recently how to create a delay between executing two separate commands in a batch file. The answer (of course) is to use the 'sleep.exe' utility. But in Microsoft's infinite wisdom, they don't just give it to you ... you've got to download it, and install it. And then remember to install it on every workstation that may need torun the batch script you're creating.
Sleep.exe is included in the free Windows 2003 Resource Kit, which you can download from here:
http://www.microsoft.com/downloads/details.aspx?familyid=9d467a69-57ff-4ae7-96ee-b18c4790cffd&displaylang=en
Last edited by смешно; 03-12-2008 at 02:05 PM.
4 main reasons why Boston is the best place to live:Red Sox (Baseball), Patriots (Football) World Champions
Celtics the NBA (Basketball), Bruins Stanley Cup (Hockey)
Помню в былые далёкие времена делали LOOPS в программах, для пауз....:grum: Представляю сколько надо таких циклов для современных CPU....:grum:Originally Posted by crazy-mike
типо
FOR i=1 to 10000000
i=i+1
NEXT
4 main reasons why Boston is the best place to live:Red Sox (Baseball), Patriots (Football) World Champions
Celtics the NBA (Basketball), Bruins Stanley Cup (Hockey)
Современный CPU такой цикл может запросто оптимизироватьOriginally Posted by смешно
![]()
Шутка с пингом работает хорошо кстати
но не ужели нету никакой команды что бы просто внутри стрипта поставить паузу на 120 секунд??? А потом не хочу я ничего на этот сервак сверх того что на нём есть инсталировать
Ничто не сближает людей так, как общее одеяло :kos:
SIN(TIME) ==== прикольнее... :grum:Originally Posted by смешно
Года 4 назад пришлось мне даже сочинять такую программульку - не мог ничего подходящего найти. Тоже понадобилась пауза в скрипте. А про пинг не догадался вовремяOriginally Posted by химик
А чем собственно плох пинг? Все равно процессору придется отвлекаться на нее, хоть пинг, хоть др. команда с отсчетом времени.
http://malektips.com/xp_dos_0002.html
Batch file SLEEP Command
SUMMARY: Cause Windows XP batch files to sleep for a given number of seconds.
Most operating systems provide a command in batch files to sleep, or wait, a certain number of seconds. This is great in that batch files can display text, allowing you time to read before continuing. Or, batch files may wait a few seconds in order to connect to other resources.
While Windows XP does not come with such a command, there are tricks to emulate it, such as a 'ping' command trick to emulate the sleep command. However, if you wish, the Windows 2003 Resource Kit provides a 'sleep' command requiring no extra tricks. The Resource Kit is a large download, but besides the 'sleep' command, the Windows 2003 Resource Kit also provides tools to remap keys, query the Active Directory, display the last 'n' lines of a text file (a tail command), and more. To download and install the Resource Kit:
1. Go to the Microsoft Windows Server 2003 download section at http://www.microsoft.com/windowsserver2003/
downloads/tools/default.mspx. Or, if that link does not work, visit http://www.microsoft.com/ and search for "Windows 2003". Once there, choose the "Downloads -> Tools" link.
2. Select the link "Windows Server 2003 Resource Kit Tools".
3. Click the "Download" link. Choose to register or not, depending on your choice, and follow the on-screen instructions to download and install the product. The default install directory is "C:\Program Files\Windows Resource Kits\Tools\".
Once the Windows 2003 Resource Kit is installed, you may need to reboot your machine for the directory "C:\Program Files\Windows Resource Kits\Tools\" to be added to your path.
Now that the sleep command is available, to see the online help, enter the following DOS command:
C:\>sleep /?
Or, just issue the command:
C:\>sleep N
Replace N with the number of seconds for batch file to 'sleep'. For example, a batch file can wait 5 seconds before continuing by issuing this command:
C:\>sleep 5
If you need to wait just a few milliseconds, issue this command:
C:\>sleep -m N
So, to sleep half a second:
C:\>sleep -m 500
Although this command supports a 'precise' millisecond sleep, I would not recommend it for real-time processing!
Насколько я понял - надо go sleep вовремя делать , а не торчать за компом до четырёх утра. :grum:
Плох тем, что этот скрипт будут видеть другие люди, и возможно смеятьсяOriginally Posted by wlass
![]()
При программировании под Win32 API чувство юмора куда-то прячется...:grum:Originally Posted by Alex_3112
There are currently 1 users browsing this thread. (0 members and 1 guests)
|
|
Terms of Service | Privacy Policy |
|