How to Execute Ruby Script in Windows? Last Updated : 13 May, 2024 Comments Improve Suggest changes Like Article Like Report Ruby is a dynamic, object-oriented programming language and a Ruby script is a plain text file containing code written in the Ruby programming language. Ruby scripts are saved with a .rb extension. Ruby scripts can be used to write programs as simple as "Hello, World!", to complex applications, such as web servers, automation scripts, or data processing tools. To execute the Ruby Script in Windows, you need to make sure that Ruby is installed in the system and that its path is added to the system's environment variables. Check if Ruby is installed and the path is added to the environment variable by typing this command in your command prompt or Powershell: ruby -v Output should look like this, version number can differ in your system so do not worry about it: In case any other output or error shows then read this article to install and set up it: How to install Ruby on Windows? Ways to execute Ruby Scripts in WindowsIn Windows, you can execute Ruby scripts using various methods but these are the most common: Using Command Prompt or PowershellUsing Ruby Interactive Shell (IRB)Using Command Prompt or PowershellCreate a file with any name and save it with ".rb" extension and write your ruby script in that file then open the Command Prompt or Powershell and locate it to the directory where you saved your Ruby Script. Here in this example, we are executing "test.rb" script: Ruby puts "Hello Geeks" puts "How are you?" This up here is our ruby script and it can be executed with the command "ruby filename.rb", in our case its "ruby test.rb": Using Ruby Interactive Shell (IRB)The Ruby Interactive Shell, usually referred to as IRB (Interactive Ruby), is a command-line tool that allows you to interactively execute Ruby code. It provides a REPL (Read-Eval-Print Loop) environment where you can type Ruby code, and it will be executed immediately, displaying the results back to you. You can start an IRB in your Command Prompt or Powershell just by typing "irb": You can execute code directly in Ruby Interactive Shell like this: You can even run the Ruby Script file directly in Ruby interactive shell by loading it with load command: Comment More infoAdvertise with us Next Article How to Execute Ruby Script in Windows? S shravanngoswamii Follow Improve Article Tags : Ruby Similar Reads How to Install SQLite3 for Ruby on Windows? SQLite is one type of SQL database engine. It is mainly written in the C programming language. It is built with a C programming library. SQLite is used basically in mobile applications & some computer applications. It is widely used for database purposes. As it is a stable application database i 2 min read How to Install Ruby Bundler on Windows? Ruby is a high-level and open-source programming language. It is very useful in many aspects. Like other programming languages, Ruby is nowadays a highly useful programming language. Bundler is a type of environment manager in Ruby. It is generally used to install and update correct Gems for Ruby. G 2 min read How to install Ruby on Windows? Prerequisite: Ruby Programming Language Before we start with the installation of Ruby on Windows, we must have first-hand knowledge of what Ruby is?. Ruby is a pure Object-Oriented language developed by Yukihiro Matsumoto (also known as Matz in the Ruby community) in the mid-1990s in Japan. Everythi 2 min read How to execute shell command in Ruby? Ruby is also known for its simplicity and versatile nature, it provides various methods for executing shell commands within your scripts. Whether you need to interact with the underlying operating system or automate tasks, Ruby offers several approaches to seamlessly integrate shell commands into yo 3 min read How to install RubyGems in Windows? RubyGems is a Ruby package manager that provides Ruby programs and libraries (also known as Gems) and the tools associated with installing and managing Ruby packages and servers. The Ruby package management, RubyGems, makes it simple to install, manage, and utilize tools and libraries for Ruby appli 3 min read How to Install RubyMine on Windows? RubyMine is a cross-platform integrated development environment (IDE) for developing Ruby web applications. It is primarily written in Java and has been maintained by Jetbrains since its launch. With many features, such as ruby gem management, rake support, automatic code completion, an integrated t 2 min read How to Install Python docutils in Windows? Docutils is an open-source text processing system written in Python. It is used to process simple text or plaintext documents into useful formats like LaTex, OpenDocument, HTML, XML, etc. It is easy to use and easy to read, and general and special purpose use. So, in this article, we will be looking 2 min read How to Run Linux Software on Windows Although Windows users could also wish to run Linux software, Linux users frequently desire to run Windows applications on Linux. You can use Linux applications without leaving Windows, whether you're searching for an improved development environment or strong command-line tools. There are several a 5 min read How to Install Protocol Buffers on Windows? Protocol Buffers (Protobuf) is a free and open-source cross-platform library used to serialize structured data. It is useful in developing programs to communicate with each other over a network or for storing data. The method involves an interface description language that describes the structure of 3 min read How to Install LISP on Windows? Lisp is a high-level machine-independent programming language that is used in making AI-based programs as it supports the implementation of such software that deals with computation with symbols efficiently. It is the second-oldest high-level programming language. In this article, we will learn abou 1 min read Like