0

I want to check whether a path has been added in windows %PATH% environment variable, using InSpec test in Chef. I'm not able to find any hints online.

describe command('echo %PATH%') do
  its('stdout') { should match /C:\SoftwareX\bin/ }
end

It's not working. Appreciate any help!

techraf
  • 64,883
  • 27
  • 193
  • 198
Kumar Vikramjeet
  • 253
  • 1
  • 4
  • 13

1 Answers1

2

echo is not a program, it's a cmd.exe built-in. Try command('cmd.exe /c "echo %PATH%"') or similar. You could also use a copy of env built for windows if you have one on the machine already.

coderanger
  • 52,400
  • 4
  • 52
  • 75