Batch file with config file

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Posts: 1
Joined: 11 Jun 2019 15:40

Batch file with config file

#1 Post by shank » 11 Jun 2019 15:51

Is it possible to use a text file as input inside a batch file? I can build a string in MS Access, but it doesn't let me save it as a *.bat file. I can save it as a *.txt file, but that does little good for my end goal. I need a batch file to merge, rename, manipulate files. The filenames will constantly change.

In my simple mind the batch would be something like:
Execute ThisTextFile.txt

And I would be constantly rewriting ThisTextFile.txt as needed.

Any suggestions to get this done?


Posts: 3625
Joined: 22 Jan 2010 18:01
Location: Germany

Re: Batch file with config file

#2 Post by aGerman » 12 Jun 2019 09:45

You can't execute a txt file. And since you didn't say anything about its content we don't even know whether it contains any executable script code. If it contains Batch code then rename it with extension bat and call it.


Posts: 2243
Joined: 12 Feb 2011 21:02
Location: United States (east coast)

Re: Batch file with config file

#3 Post by dbenham » 12 Jun 2019 15:09

It sounds like you are trying to dynamically write a batch script. That should not be necessary.

Except in very rare circumstances, you should be able to write a static batch script that reads and processes a data (.txt) file with FOR /F.

You can dynamically create the .txt file with MS Access. The file can contain a list of files and/or folders. You could possibly include some keyword(s) to indicate what you want to do with each file.

Then simply run your batch script and let it read the keywords and files and process each one.

Dave Benham

Post Reply