中国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-09-15 14:06
47,812 topics / 349,917 posts / today 0 new / 48,268 members
DOS批处理 & 脚本技术(批处理室) » [Help with Strange Problem]How to achieve delay when START calls internal commands
Printable Version  1,612 / 5
Floor1 HUNRYBECKY Posted 2006-12-30 23:17
银牌会员 Posts 442 Credits 1,179
Why does the /W parameter of the start command work when starting other programs but not when calling internal commands? I have checked many previous posts and none mentioned the delay of START when calling commands, only when calling other programs.


How to make START wait for 200 seconds to complete after executing shutdown -s -t 200 in the above code, then continue to execute shutdown -a and wait for completion, then continue to execute START /W XCOPY /S/C/H/R/Y rpl\*.* d:\, and after the copy is completed, execute shutdown -s -t 100.

Explanation: Although each internal command can be written into a BAT file to achieve, but it is very troublesome when there are many commands. How to solve this problem? Is it really impossible for START to handle internal commands?

[ Last edited by HUNRYBECKY on 2006-12-30 at 11:55 PM ]
Floor2 HUNRYBECKY Posted 2006-12-31 00:02
银牌会员 Posts 442 Credits 1,179
Although using start is difficult to achieve the delay of internal commands, but SLEEP can be used to achieve it. The following effect is very good, post it for everyone's reference. Now there is no need to worry about the bad habits of EMULE anymore.
@echo off
rem Solve the problem that the automatic shutdown after using EMULE to download will damage the download, and write this script.
SET /P STIME=How long to shut down later? Enter the time plus lowercase h, m or s, such as 1h means one hour:
SLEEP %STIME%
ECHO Backing up files, please wait.......
if not exist d:\rpl\ md d:\rpl
XCOPY /S/C/H/R/Y d:\emule\temp\*.bak d:\rpl\
shutdown -s -t 100
@echo on
EXIT
Floor3 lxmxn Posted 2006-12-31 01:01
版主 Posts 4,938 Credits 11,386

  Can't delay be achieved with ping?
Floor4 hxuan999 Posted 2006-12-31 01:47
中级用户 Posts 161 Credits 337
START Actually, when running a program, if it's an internal CMD command or a batch file, it's called by default with CMD /K, and /K keeps the window open, so it can achieve a delay. But there's a problem: if the CMD command being run is a 32-bit GUI program, the CMD returns to the command prompt without waiting for the application to terminate. If executed in the CMD command line, it doesn't run. So SHUTDOWN returns directly. It seems that it wasn't called with /K.
You can try START /W CMD /K SHUTDOWN -S -T 100.
Here, actually, you can just use CMD directly.
Floor5 HUNRYBECKY Posted 2007-01-03 08:32
银牌会员 Posts 442 Credits 1,179
Originally posted by hxuan999 at 2006-12-31 01:47:
START Actually, when running a program, if the program being run is an internal CMD command or a batch file, it is defaulted to be called with CMD /K. /K means the window is retained after running the program, so that the delay can be achieved. But there are still questions..



Thank you brother for your answer, but what you gave still doesn't work.
Floor6 HUNRYBECKY Posted 2007-01-03 08:35
银牌会员 Posts 442 Credits 1,179
Originally posted by lxmxn at 2006-12-31 01:01:

Can't the delay be achieved using ping?



What I mean by delay is not the delay you mentioned.
I mean how to delay when calling some internal commands, especially when there is a graphical interface.
For example, the command START /W shutdown -s -t 200. I want to wait until the shutdown window closes and finishes before executing another command. Haha, you can try it, it's quite difficult, right.
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023