make a folder of prompts from a simple txt file

$sourceFile = "C:\Users\username\Desktop\text\weird.txt"
$delimiter = "\n"
$splitFilePrefix = "C:\Users\username\Desktop\weird1\weird_"
$counter = 1
$content = Get-Content -Path $sourceFile -Raw
$chunks = $content -split $delimiter

foreach ($chunk in $chunks) {
    $fileName = $splitFilePrefix + $counter.ToString("000")+".txt"
    $chunk | Set-Content -Path $fileName
    $counter++
}

this works assuming that you have 1 prompt per line with \n a line break 

the script will go line by line and make a txt file for each line in the txt file

put this code above in a txt file, rename the txt file to anything and change the file from samplename.txt to samplename.psl

$sourceFile = location and name of file to break up into many files

$delimiter = the way for the code to know when to go to next line

$splitFilePrefix = folder location and prefix for each new file which will be numbered

then open powershell in folder with the .\\samplename.ps1 file you created

and run

.\\samplename.ps1

 

This article was updated on July 4, 2026