![]() |
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-24 20:49 |
47,812 topics / 349,917 posts / today 0 new / 48,274 members |
| DOS批处理 & 脚本技术(批处理室) » If you want to achieve that running A.bat calls B.bat and then runs C.bat after B.bat is completed. |
| Printable Version 2,710 / 18 |
| Floor1 ivanisme | Posted 2007-03-20 05:19 |
| 初级用户 Posts 13 Credits 30 | |
|
There are three batch files, A, B, and C.
A has the function of running B and C. Want to realize the following function: Run A.bat, Call B.bat. If B.bat runs successfully, then run C.bat. In short, run in the order of A, B, C. C.bat should not run before B.bat is finished. PS: Is there a concept of sleep in DOS? [ Last edited by ivanisme on 2007-3-20 at 09:16 AM ] |
|
| Floor2 Kinglion | Posted 2007-03-20 06:02 |
| 铂金会员 Posts 1,924 Credits 5,798 From 金獅電腦軟體工作室 | |
|
I know but won't answer you. Didn't you read the "Newcomer Must-Read" post on the forum carefully when you registered?
|
|
| Floor3 ivanisme | Posted 2007-03-20 06:15 |
| 初级用户 Posts 13 Credits 30 | |
| Floor4 lxmxn | Posted 2007-03-20 06:17 |
| 版主 Posts 4,938 Credits 11,386 | |
|
The code in A.bat is just one line: call B.bat&&call C.bat; What you mean by sleep is the meaning of delay? |
|
| Floor5 Kinglion | Posted 2007-03-20 06:26 |
| 铂金会员 Posts 1,924 Credits 5,798 From 金獅電腦軟體工作室 | |
|
If you want to implement that running A.bat calls B.bat and then runs C.bat after B.bat is completed.
|
|
| Floor6 ivanisme | Posted 2007-03-20 07:38 |
| 初级用户 Posts 13 Credits 30 | |
Originally posted by lxmxn at 2007-3-19 05:17 PM: If there are calls to exe in B.bat, it won't work. Sleeping means delaying, which is thread Sleep |
|
| Floor7 lxmxn | Posted 2007-03-20 07:49 |
| 版主 Posts 4,938 Credits 11,386 | |
Originally posted by ivanisme at 2007-3-19 18:38: If there are EXE files, you can use the start command to call them; start /min "" exefile.exe Oh, this can be indirectly achieved by using the ping command to delay; ping 127.1 5 >nul 2>nul, which can delay for about 4 seconds. |
|
| Floor8 ivanisme | Posted 2007-03-20 21:48 |
| 初级用户 Posts 13 Credits 30 | |
|
The current situation is that there is something that calls an exe in B.bat. C.bat calls other bat files. A.bat still calls B.bat and C.bat (C should be executed after B is completed). Brother lxmxn, do you have any good methods?
|
|
| Floor9 lxmxn | Posted 2007-03-20 23:03 |
| 版主 Posts 4,938 Credits 11,386 | |
|
Several batch processes can do things, and one batch process can also be completed. Just tell me what purpose you ultimately want to achieve. |
|
| Floor10 ivanisme | Posted 2007-03-20 23:26 |
| 初级用户 Posts 13 Credits 30 | |
|
The function of this batch processing is: First call an exe program (this takes time), and then run an external bat file (supplied by others). If the exe is not started properly and then the bat is run, it will report an error. So the bat must be run after the exe. I wonder if my expression lxmxn can understand it?
|
|
| Floor11 lxmxn | Posted 2007-03-20 23:31 |
| 版主 Posts 4,938 Credits 11,386 | |
|
After the exe file runs, there is a delay of about 4 seconds, and then your bat file runs.
|
|
| Floor12 ivanisme | Posted 2007-03-21 00:11 |
| 初级用户 Posts 13 Credits 30 | |
|
Hehe! First of all, thank you for lxmxn's reply.
I tried it and MS works. Just have some questions about -n 5. I checked ntcmds but couldn't figure it out. How is the time controlled? Can't it be controlled? I'm stupid, hope lxmxn can give me some advice! |
|
| Floor13 free2 | Posted 2007-03-21 01:25 |
| 初级用户 Posts 10 Credits 124 | |
|
If it were me, I would CALL C.BAT in B.BAT, and then put the remaining A.BAT C/P to the end of C.BAT
|
|
| Floor14 ivanisme | Posted 2007-03-21 02:10 |
| 初级用户 Posts 13 Credits 30 | |
Originally posted by free2 at 2007-3-20 12:25 PM: You didn't understand it! |
|
| Floor15 lxmxn | Posted 2007-03-21 02:16 |
| 版主 Posts 4,938 Credits 11,386 | |
|
Re ivanisme: The ping command has many parameters, among which there are the -n and -w parameters. The -n parameter indicates the number of sent ICMP packets, and the -w parameter indicates the time interval for timeout, meaning if the specified host is not reachable via ping, after how many seconds the packet will be re-sent. By default, the value of the -w parameter is 1000, which represents one second, and the -n parameter specifies the number of sent times. So specifying the -n parameter can determine the amount of delay. Using the principle of planting trees, if you want to delay for n seconds, then the parameter -n is specified as n + 1. ping 127.1 -n 5 Here, "-n 5" means specifying the value of the -n parameter as 5, so it delays approximately 4 seconds. [ Last edited by lxmxn on 2007-3-20 at 01:34 PM ] |
|
| 1 2 Next |
|
[ Contact the Union admin team -
中国DOS联盟 -
Standard version ] Sponsored by ifanr Inc | © 2001–2023 |