开发者

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

I have a file "test.bat" which has code to replace strings 开发者_C百科in a file - but I Don't get how it can work ?


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜