How to check if string already exist in path env variable?

i want to put a not if to check path variable contain string or not ?

I do not know which platform you want to run your code on, but you can specify the interpreter for your not_if and only_if guards with the guard_interpreter property
https://docs.chef.io/resource_common.html#guard-interpreters

Then simply just right your corresponding code in the guards.

I am using windows platform and can you show me how to put not_if on env variable to be checked

some_resource 'name' do
  ...
  guard_interpreter :powershell_script
  not_if "$env:Path | Select-String 'some_value' "
end