Can somebody please tell me what is the code to find out the OS that your ruby script is running on.
This script will be running on Windows OS only
2 Replies - 12606 Views - Last Post: 19 June 2007 - 01:50 AM
#1
How to find out the OS that your ruby script is currently running on
Posted 18 June 2007 - 09:32 AM
#5
Re: How to find out the OS that your ruby script is currently running on
Posted 18 June 2007 - 11:45 PM
A good idea is to execute
For Windows systems, the output would be Windows_NT.
However this will return you an empty string for Linux. For further probing, you can use the following line,
which will give you the output i386-mswin32 for x86 Windows machines. Linux systems will output "linux" instead of "mswin32" in this case.
puts ENV['OS']
For Windows systems, the output would be Windows_NT.
However this will return you an empty string for Linux. For further probing, you can use the following line,
puts RUBY_PLATFORM
which will give you the output i386-mswin32 for x86 Windows machines. Linux systems will output "linux" instead of "mswin32" in this case.
#6
Re: How to find out the OS that your ruby script is currently running on
Posted 19 June 2007 - 01:50 AM
Thanks for that rahulbatra
Page 1 of 1
|
|

New Topic/Question
Reply




MultiQuote




|