Re stonewall:
First, let's talk about a simpler feasible solution: In fff.bat, use cd to change the current path of the batch processing, then filter the result of test.bat to the new current path and name it test.bat, and then call xxx.bat. At this time, the test.bat called in xxx.bat is our customized version.
This solution involves two problems. One is how xxx.bat is called; because the current path has changed, the path needs to be added when calling, but saving and obtaining the original path is more troublesome (under NT series, the original path can be returned by saving the %cd% variable), it is better to directly copy the original xxx.bat to the new path and then jump; the second is how to return to the original current path. After jumping to the new path, returning to the original path still requires saving and obtaining the original path. A simple processing method is to create a subdirectory in the original path, and then use this subdirectory as the new path, and when returning, directly cd.., but the original path may be read-only.
Then talk about another more complicated solution: If the platform you are using is the WinNT series, then you can use the for /f command to filter xxx.bat to get a new batch processing %temp%.\_xxx.bat, in which replace the call of test.bat with the call of %temp%.\_test.bat, then you call %temp%.\_xxxt.bat in fff.bat. If you are using the Win9x/MSDOS series, you can use a third-party command to replace this call string, such as hexc, change, which can also be applied to the WinNT series.
Of course, such a solution has a big turn. If your test.bat call is at the beginning or end of xxx.bat, you can integrate it into fff.bat, placed in the previous or next sentence of the xxx.bat call.
In addition to this, we are left with the difficult problem of "shielding internal commands". If it is at the command line, the macro command of doskey (doskye pause=rem) can be used to achieve, but unfortunately, macro command calls are not supported in batch processing.
※ Batchinger 致 Bat Fans:请访问
批处理编程的异类 ,欢迎交流与共享批处理编程心得!