1

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 in a file - but I Don't get how it can work ?

1 Answer 1

4

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.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.