在批处理文件中运行命令行 [英] Running command-line in batch file
本文介绍了在批处理文件中运行命令行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有以下似乎无法正常运行的代码-有人可以协助您如何在批处理文件中运行命令行
I have the following code which doesn't seem to be working properly - is someone able to assist with how to run command-lines in batch files
@echo off
set changeFrom=321
set changeTo=123
set origFile=config.txt
set newFile=config1.txt
test.bat %changeFrom% %changeTo% %origFile%>%newFile%
del %origFile%
ren %newFile% %origFile%
::end
我有一个文件"test.bat",其中包含用于替换文件中字符串的代码-但我不知道它如何工作?
I have a file "test.bat" which has code to replace strings in a file - but I Don't get how it can work ?
推荐答案
您需要像这样从第一个开始使用调用来执行第二个bat文件:
You need to use call to execute the second bat file from the first like this:
call test.bat %changeFrom% %changeTo% %origFile%>%newFile%
不调用,第一个批处理脚本将在第二个退出时退出.
without call the first batch script will exit when the second one exits.
这篇关于在批处理文件中运行命令行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文