module Mixlib::ShellOut::Windows

def which(cmd)

FIXME: reduce code duplication with chef/chef
def which(cmd)
  exts = ENV["PATHEXT"] ? ENV["PATHEXT"].split(";") + [""] : [""]
  # windows always searches '.' first
  exts.each do |ext|
    filename = "#{cmd}#{ext}"
    return filename if File.executable?(filename) && !File.directory?(filename)
  end
  # only search through the path if the Filename does not contain separators
  if File.basename(cmd) == cmd
    paths = ENV["PATH"].split(File::PATH_SEPARATOR)
    paths.each do |path|
      exts.each do |ext|
        filename = File.join(path, "#{cmd}#{ext}")
        return filename if File.executable?(filename) && !File.directory?(filename)
      end
    end
  end
  false
end