Discussion forum for all Windows batch related topics.
Moderator: DosItHelp
-
mathiasben
- Posts: 2
- Joined: 30 Dec 2014 17:53
#1
Post
by mathiasben » 31 Dec 2014 11:14
Hello,
I'm working on automating adding printers to desktops across a large enterprise network (350+ printers) and have it mostly worked out but I've had to do most of the coding of the scripts by hand. I'd like to put together another script that will enable others to add and remove printers and not have to dig through the code to do so. I've got parts of the add script worked out; using TYPE I've been able to print to a file everything as it should appear in the script. So my question is - how do I then insert that file into the other script? Something that would use FINDSTR to locate a marker and place the contents of the file behind it would do the trick I think. Then for the removal part something that would search out the marker and then delete a set number of lines following it, cause each printer entry is a specific length.
I hope that I have described what it is that I'm attempting to do accurately.
thank you,
matt
-
foxidrive
- Expert
- Posts: 6031
- Joined: 10 Feb 2012 02:20
#2
Post
by foxidrive » 31 Dec 2014 13:30
mathiasben wrote:using TYPE I've been able to print to a file everything as it should appear in the script. So my question is - how do I then insert that file into the other script? Something that would use FINDSTR to locate a marker and place the contents of the file behind it would do the trick I think.
Examples would help us understand what you are trying to do.
-
mathiasben
- Posts: 2
- Joined: 30 Dec 2014 17:53
#3
Post
by mathiasben » 31 Dec 2014 14:00
hello foxidrive,
I don't have any examples, I'm simply looking for a way to insert a .txt file into another batch file at a specific location. I'm trying to create a batch file that can be used to automate the editing of a larger batch file that I created by hand. If you needed to add the contents of a .txt file to another file how would you go about it? I'm looking for a method to accomplish this. Any ideas would be appreciated! thanks!
-
foxidrive
- Expert
- Posts: 6031
- Joined: 10 Feb 2012 02:20
#4
Post
by foxidrive » 31 Dec 2014 14:11
You can read part of a file into a new file,
append the text file using type,
and then read the rest of the file into the new file
and rename the resulting files.