500Views6Replies

Author Options:

Is there a Batch file command to allow me to edit another batch file? Answered

Hi, I am trying to create a bbatch program that moves files from a certain directory to another. The problem I have is that this directory will be different on every computer. Is there a way I can create another batch file where the user enters the directory of the files to be moved and insert this into the required place in my original file?

Comments

The forums are retiring in 2021 and are now closed for new topics and comments.
0
thegeeke
thegeeke

9 years ago

Set /p "com="
Echo %com% >>(your file here)

That will add the user input in the end of a .txt file, I think it will do the same with a .bat. If you need to add any more text before or after the input, add it before or after %com%.

Good luck! :)

0
Prof. Pickle
Prof. Pickle

Answer 8 years ago

That is a good answer, but there are many other ways to do it.

There's the EDIT command and COPY CON.

All of these work effectively.

0
thegeeke
thegeeke

Answer 8 years ago

Yep. I agree. I'm not really a programmer, I'm a hardware guy; but since no one else answered, I did the best I could. :)