Posted  by 

Opening Ruby Files In Windows

Windows Command Line Ruby is a scripting language and most of the time you will use it from the command line. For years Windows has been known for its poor command line interpreter. Although Microsoft has improved it in Windows XP and later versions, it still lacks some features which come in very handy when developing Ruby applications. In this chapter you'll learn how to use Command Prompt and adjust it for Ruby development.

Update Ruby WindowsRuby Files In A Directory

Ruby for Newbies: Working with Directories and Files. The working directory will be the first place your shell looks to find the file. F = File.open.

Click on the start button in the lower left corner, then on All Programs and Accessoriess. In the list of applications you'll see Command Prompt. Click on it and new command prompt window will open. It is time to make first adjustment. Normally Windows command prompt uses raster fonts and cannot display Unicode characters.

Click on the icon in the top left corner of command prompt window and then on Properties menu item (Figure 1-2). In the properties dialog box activate Font tab and select either Lucida Console or Consolas. These two fonts are TrueType monospaced fonts and can display characters from Unicode character set. Font size doesn't matter so you can choose the one that suits you the best.

Running application from the Command Prompt can be done either by giving full path to the executable file. Microsoft Windows [Version 6.

7601] Copyright (c) 2009 Microsoft Corporation. All rights reserved. C: >notepad Let's stop here for a second and see what path actually is. The path to a file or a folder is its address on the computer. On Windows operating systems path consists of a drive letter and all directories and sub-directories which determine location of a file or a folder in the system. Operating system uses path to find a file. In our case it means that system will search for notepad.exe file on drive C: in the Windows folder.

Invoking application by giving full path to the executable every time is quite inconvenient. Besides, if application loads dynamic libraries, system is searching for them in the application directory first and then in the path. Therefore if you want to use application from the Command Prompt it is recommended to put it in the directory which is in the system path. Whenever you issue command in the Command Prompt, system will search for the executable first in the current directory and if it doesn't find it, search will continue through all directories listed in the path. Folders are searched in the exactly same order as they are listed in the path. Now it is time to check what is a value of the path system variable. Open new Command Prompt and type. Black And Decker 7980 Manual more.

C: >echo%PATH% C: Windows system 32;C: Windows;C: Windows System 32 Wbem As you can see we currently have only few system directories in the path. These directories will be searched whenever you issue command in the Command Prompt if executable is not found in the current directory. Back In Black Sheet Music Guitar there. System will first look for the executable in the C: Window System32, then in the C: Windows and finally in the C: Windows System Wbem.

Note that directories in the path are separated by semicolon. This separator must be used whenever you want to add new directory to the path as we'll see later. Altering path for the current Command Prompt is done simply by invoking set command. C: >set PATH =C: Windows system 32;C: Windows;C: Windows System 32 Wbem Removing all directories from the path when new directory is added surely is not a good way to alter system path.

What we actually want is to be able to add new directory without removing existing ones. As we already saw system will set variable to the value we pass after equal sign. This means we can just put our new directory and all already existing directories in the statement for setting system path. This requires lot of typing. Luckily there is a shortcut. Using system variable%PATH% allows us to keep existing directories while we are adding new one. C: >set PATH =C: Ruby 22;%PATH% C: >echo%PATH% C: Ruby 22;C: Windows system 32;C: Windows;C: Windows System 32 Wbem As you can see set statement keeps the order of directories and you must be careful when you set the path.