Quantcast
Channel: Windows PowerShell Forum
Viewing all articles
Browse latest Browse all 2562

Modify Output and pipe to user selection

$
0
0

Hi there,

I searched the internet for quite some time but I'm stuck. I'd like to dirlist a directory, modify the output and have the user to select an item and assign it to a variable.

So basically:

dir | fl name

Name : file1.txt

Name : file2.txt

At this point I'd like to cut off "Name :" and ".txt", have the user to select "file1" or "file2" and assign the chosen file to a variable.

Any help would be greatly appreciated!

EDIT:

Ok, I just realized I can accomplish the first part by:

PS:\ (dir).name
1.txt
2.txt
Now I need to cut off ".txt" and pipe it to a user selection.




Viewing all articles
Browse latest Browse all 2562

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>