0

I ran the following very simple command in powershell. However it does not seem to be working:

If("2f7c654f-16ce-46d8-a037-9827916ba655_opt.script" -contains "2f7c654f-16ce-46d8-a037-9827916"){"hi"} 

Can someone please guide me as to where am I going wrong

Jannat Arora
  • 2,759
  • 8
  • 44
  • 70

1 Answers1

2

the -contains operator is an array operator, not a string operator. it tests for an exact match with one or more items in an array. that is a really common mistake. [grin]

you want the .Contains() string method.

Lee_Dailey
  • 7,292
  • 2
  • 22
  • 26