Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Search String...

$
0
0

Hello all,

I am looking for some help in term of searching a string using powershell.

Here is what I have:

$FldrPath = "\Test\Test1"

and I have an dynamic array $arry for which the value of $arry[0] changes to the below value:

\Test

\Test\Test1

\Test\Test1\A

\Test\Test1\B

\Test\Test1\C

\Test\Test2

\Test\Test3

Within the loop I have the below code:

$FindMatch = $arry[0] -like $FldrPath

Write-Host $FindMatch

************

The problem I am facing is that when I run the script only line item 2 "\Test\Test1" it returns a value of True for everything else it returns False.

I need the script to return TRUE for line item 2,3,4 & 5.

Any idea what I am doing wrong?


Viewing all articles
Browse latest Browse all 21975

Trending Articles



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