397Views6Replies

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?

6 Replies

user
Prof. Pickle (author)2012-12-14

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

Select as Best AnswerUndo Best Answer

user
thegeeke (author)Prof. Pickle2012-12-16

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

Select as Best AnswerUndo Best Answer

user
Prof. Pickle (author)2012-12-15

Also, dostips has a function to add a line of text to any line in any file. http://www.dostips.com/?t=Function.append

Hope that helps!

Select as Best AnswerUndo Best Answer

user
thegeeke (author)2012-03-23

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

Select as Best AnswerUndo Best Answer

user
Prof. Pickle (author)thegeeke2012-12-13

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.

Select as Best AnswerUndo Best Answer

user
thegeeke (author)Prof. Pickle2012-12-14

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

Select as Best AnswerUndo Best Answer