this post was submitted on 28 Mar 2024
4 points (100.0% liked)
Programming
13376 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.
It's markdown, you should be able to indent your lines by 4 spaces or fence with triple backtics to get code blocks. Your client's editor may have a button to help
Becomes
That's good to know. Thanks!
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?
It's just a Notepad text file.
The confusion is that CSV is also just a Notepad text file that uses Commas to Separate Values.
They are asking about what kind of values are in it.
Just words? It's a list of names.