How to I launch a ruby script from the command line by just its name?

后端 未结 3 1326
隐瞒了意图╮
隐瞒了意图╮ 2020-11-30 13:28

On windows, I can run my ruby script like this:

> ruby myscript.rb

but I want to set things up so that I can just do this instead?..

3条回答
  •  粉色の甜心
    2020-11-30 14:05

    None of the command line solutions worked for me on Windows 10. I've previously used the Windows GUI to open .rb files using Notepad++. When I run

    script.rb

    in the command line, it just opens Notepad++ with the .rb file (even after the command line fixes).

    What solved the issue for me was

    1. Right click a .rb file
    2. Click "Open With"
    3. Click "Choose another app"
    4. Click "More apps"
    5. Click "Look for another app on this PC"
    6. Open the ruby.exe interpreter from my ruby installation.

提交回复
热议问题