Powershell command file to automatically list file/folder names


  1. Posts : 2
    Windows 10 Pro
       #1

    Powershell command file to automatically list file/folder names


    I used "dir /b > file.txt" in a shift+right-click command prompt window to get the result I needed. Now, shift+right-click only shows the option for Powershell. I don't necessarily want to edit the registry to change that so I'm trying to adapt. In Powershell, using the command "ls | % Name file.txt" does the trick but there's two things I want to be able to do...

    1) Double-click a single command file to run the script and automatically generate the text file I need
    2) Have the script ignore the "file.txt" and the command file itself (because it adds "file.txt" to the list, which I don't need)

    I have tried making a .ps1 file but my knowledge is very limited on using Powershell and I can't get it work exactly how I need. I don't need anything from the list other than the file/folder name itself (no properties such as size, type, etc.) Any help would be appreciated.

    Thanks!
      My Computer


  2. Posts : 494
    Win 10 Pro x64 versions
       #2

    Below is a tutorial on reviving the Shift+Right Click command prompt.

    Add or Remove Command Prompt Open Here Context Menu in Windows 10
      My Computer


  3. Posts : 2
    Windows 10 Pro
    Thread Starter
       #3

    Railtech said:
    Below is a tutorial on reviving the Shift+Right Click command prompt.

    Add or Remove Command Prompt Open Here Context Menu in Windows 10
    I've had a look at that website before and it has its uses but I was trying to get it all done in Powershell because it works over the network. Command Prompt doesn't like working with mapped network drives. After giving up for a while and coming back to it, I had a stroke of luck with this Powershell .ps1 command file to get both folders in one file
    Powershell command file to automatically list file/folder names-capture.png

    Here's a screenshot so hopefully someone else may find this useful
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 22:38.
Find Us




Windows 10 Forums