Batch Prompt Loader
A folder of TXT prompts is all this batch loader needs — Queue to advance
- clip
- conditioning
- filename
- index
- total_count
You want fifty images, each with its own prompt, and you don't want to sit there retyping between runs. That's the whole reason this node exists: it reads one .txt file per run from a folder, encodes it through your CLIP, and hands the conditioning to the sampler - then, with the right dropdown, every Queue quietly moves to the next file. The name is not a lie: it's a Batch Prompt Loader, not a queue manager or API wrapper. No keys, no calls out, no third-party dependencies. Just a folder of text files and ComfyUI's own CLIP.
It's a small, single-node pack from ReSerendipity with a Chinese-language README and barely any footprint in the Western community - a niche-but-earnest tool you find when plain batch of prompts stops cutting it. If your prompts differ only by a token or two, a wildcard node suits you better; this one shines when each prompt is genuinely its own file, like forty oil-painting scene descriptions you want run through the same model and seed.
How it works
Under the hood it's a CLIP Text Encode with file I/O bolted on. Each run, the node scans folder_path, sorts the files (case-insensitive, lexicographic), picks one by index, reads it, tokenizes it via the connected clip, and runs encode_from_tokens the same way the core text-encode node does. Out comes a real CONDITIONING plus filename, index, and total_count so the rest of the graph knows where you are.
The clever bit is on the current_number input. It's a plain INT widget, but it carries the same control_after_generate dropdown you already know from seeds - fixed, increment, decrement, random. Right-click it, set it to increment, and each Queue steps the loader to the next prompt file. No extra seed node, no logic wiring. There's also a persistent counter file under user/default/ so the position survives a ComfyUI restart - the loader remembers where it stopped overnight. Trade-off: that file is shared instance-wide, so running two of these in one workflow and stepping both means they fight over the same saved index. One loader per workflow is the smooth path.
The inputs that matter
folder_path- where the prompts live, relative toComfyUI/input. Drop a folder likeinput/batch_promptsand typebatch_prompts.current_number- the file index to read; set its control_after_generate to increment/decrement/random for stepping.clip- from your CLIP Loader, plain and simple.skip_exists(optional) - checks youroutput_folderfor an image named after the current prompt file and skips if present.
recursive sweeps subfolders, file_pattern filters by wildcard (SFW_*.txt), and reverse_order flips the list. Defaults are fine for most people.
Wiring the outputs
conditioning goes straight into the KSampler's positive input, replacing your normal CLIP Text Encode. filename is the sneaky useful one - connect it to Save Image's filename_prefix and each image saves under its prompt file's name. index and total_count feed a Display Int for visible progress, and the console already prints [n/total] filename on every run.
One honest catch: only the positive conditioning comes out. The loader parses a positive:/negative: section format in your files, but there's no negative conditioning socket on the output - for a fixed negative across the whole batch, keep a regular CLIP Text Encode node feeding the sampler's negative input.
Installing it
ComfyUI Manager → search Batch Prompt Loader (pack title ComfyUI-BatchPromptLoader), or:
cd ComfyUI/custom_nodes
git clone https://github.com/ReSerendipity/ComfyUI-BatchPromptLoader.git
Restart, then right-click the canvas and search "Batch Prompt Loader". Its requirements.txt is deliberately empty - no external dependencies beyond what ComfyUI and PyTorch already give you, which makes it one of the less painful installs you'll do.
Where people get burned
The path jail (v2.1.2+). folder_path is confined to ComfyUI/input, log_folder to ComfyUI/user, output_folder to ComfyUI/output. That's a security fix against path traversal, but it means you can't point it at an arbitrary prompts directory - put the folder under input and type only its name. An absolute path or a .. escape gets refused with a clear error.
Sort order is lexicographic, not numeric. 10.txt sorts before 2.txt, because "1" < "2" as characters. Zero-pad your names (prompt_01 … prompt_10) if the sequence matters, or you'll get a surprise order.
Skipped files emit empty conditioning. When skip_exists or enable_logging (a JSON log under user/ that remembers processed files) causes a skip, you get a placeholder conditioning, not nothing - and the README warns a sampler fed that will produce black or garbage. The intended pattern is to intercept the filename output (SKIPPED:... or ALL_DONE markers) with a Switch node and let the empty branch fall through. For a handful of runs it's simpler to watch the console; for a 100-file job you resume after a crash, the logging is genuinely the feature that saves your weekend.
Inputs (11)
| Name | Type | Default | Description |
|---|---|---|---|
| clip | CLIP | — | |
| folder_path | STRING | batch_prompts | Relative to <ComfyUI>/input. Must stay inside that folder. |
| current_number | INT | 00–999999 | — |
| recursive | BOOLEAN | true | — |
| reverse_order | BOOLEAN | false | — |
| file_pattern | STRING | *.txt | — |
| output_folder | STRING | output/ | Relative to <ComfyUI>/output. Must stay inside that folder. |
| enable_logging | BOOLEAN | false | — |
| log_folder | STRING | default/batch_prompt_logs | Relative to <ComfyUI>/user. Must stay inside that folder. |
| clear_log_on_start | BOOLEAN | false | — |
| skip_existsopt | BOOLEAN | false | — |
Outputs (4)
| Name | Type | Description |
|---|---|---|
| conditioning | CONDITIONING | — |
| filename | STRING | — |
| index | INT | — |
| total_count | INT | — |