-1

I have a folder, folder A in a file path, inside folder A are multiple folders (folder 1, folder 2, folder 3). I want to create a Powershell script that goes to the file path where folder A is, read the names of the folders in it and create a .txt file

Inside the .txt file it would have:

folder 1

folder 2

folder 3

I'm not sure how to do this

(there shouldn't be the extra lines in between each folder name in the .txt file, I just can't figure out how to format it properly

ripndip
  • 11
  • 3
  • 4
    SO isn't code writing service. You should at least try to solve the problem first, then ask about specific problems you're having. – boxdog Feb 12 '21 at 00:57
  • @boxdog Thank you for pointing that out. As you probably saw, this is my first time using Stack Overflow. – ripndip Feb 12 '21 at 04:23

1 Answers1

1

So I figured out the solution to my problem. What I was looking for was:

c:\Windows> Get-ChildItem -Path C:\Users... -Name | Out-File -FilePath C:\Users...\test.txt

This outputs the names of the directories that I put in the path and takes them into the test.txt file

ripndip
  • 11
  • 3