- This topic has 5 replies, 4 voices, and was last updated 2 months, 2 weeks ago by
June 29, 2020 at 11:52 am #238949ParticipantTopics: 3Replies: 3Points: 33Rank: Member
I have variable $path. It contains more than 2 paths like:
I need to trim $path (last *.txt) to : (expectenced)
Does anyone have ane idea how to trim it?
June 29, 2020 at 12:16 pm #238964
June 29, 2020 at 12:33 pm #238970ParticipantTopics: 3Replies: 3Points: 33Rank: Member
Yes I treid. I was focused to manipulation text with split, splitend and indexof. i did’n knwo split-path cmdlet
June 30, 2020 at 4:11 pm #239303ParticipantTopics: 9Replies: 10Points: 47Rank: Member
or you could use both split and trim like:
June 30, 2020 at 4:46 pm #239312ParticipantTopics: 7Replies: 2458Points: 6,439Rank: Community MVP
or you could use both split and trim like
I’m afraid the .trim() method does not work like you think it does. Try the following snippet. It might help you to understandPowerShell1'trim specified charachters'.trim('srthcae')
June 30, 2020 at 4:55 pm #239327ParticipantTopics: 0Replies: 11Points: 118Rank: Participant
Use the Split-Path command. Of course since your original variable is an array of paths you will need to iterate through that array and run the Split-Path on each element of the array.
- You must be logged in to reply to this topic.