this post was submitted on 28 Mar 2024
4 points (100.0% liked)
Programming
13362 readers
1 users here now
All things programming and coding related. Subcommunity of Technology.
This community's icon was made by Aaron Schneider, under the CC-BY-NC-SA 4.0 license.
founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
What's the format of the text file?
His example doesn't seem to perform any comparisons to determine what to name the file. If the text file is just a list then something like this could work:
$file = Get-Content -Path .\individuals2.txt
foreach ($line in $file) { Copy-Item -Path .\template.docx -Destination ".$(2 + $line + '.docs')" }
Edit: Wow, Lemmy destroys formatting.
Thanks for your help, but I had a couple errors pop up when I tried this out. I don't need to input anything in the code you provided, do I?