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?


I understand, I only answered because I'm bored out of my mind.

HaHa... I wish I had that problem! :) I'm sure the OP posted it and never looked back to see if anyone answered it... :(

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! :)

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.

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. :)