cmd = "puts Time.local(2009).zone" zones = ['America/New_York5:00:00', 'Asia/Kuwait'] zones.each do |tz| ENV['TZ'] = tz puts `ruby -e \"#{cmd}\"` # Prints two different values on Windows end zones.each do |tz| ENV['TZ'] = tz eval(cmd) # Prints the same value on Windows since changing ENV[‘TZ’] on the fly does not work end