Running a selfwritten ruby program outside of an IDE










1















I was wondering if it was possible to run a selfwritten ruby program just like any other program by double-clicking an icon of some sort.



And if it's possible, how do I do it?



I wrote a little program for a friend but I don't want him to have to use the command line to run it, because that's rather inconvenient (unless there is a way to just double-click and the command line opens the program itself..).



Thanks for your help!










share|improve this question

















  • 1





    Creating a batch script that runs the command for them is the simple option. What OS are you/they on?

    – Carcigenicate
    Nov 11 '18 at 13:32












  • I'm on Windows 10 he should be on Windows 7

    – Brunhilde Line
    Nov 11 '18 at 13:35











  • Or you can use a 'packager' like ruby-packer

    – Axe
    Nov 11 '18 at 13:36















1















I was wondering if it was possible to run a selfwritten ruby program just like any other program by double-clicking an icon of some sort.



And if it's possible, how do I do it?



I wrote a little program for a friend but I don't want him to have to use the command line to run it, because that's rather inconvenient (unless there is a way to just double-click and the command line opens the program itself..).



Thanks for your help!










share|improve this question

















  • 1





    Creating a batch script that runs the command for them is the simple option. What OS are you/they on?

    – Carcigenicate
    Nov 11 '18 at 13:32












  • I'm on Windows 10 he should be on Windows 7

    – Brunhilde Line
    Nov 11 '18 at 13:35











  • Or you can use a 'packager' like ruby-packer

    – Axe
    Nov 11 '18 at 13:36













1












1








1








I was wondering if it was possible to run a selfwritten ruby program just like any other program by double-clicking an icon of some sort.



And if it's possible, how do I do it?



I wrote a little program for a friend but I don't want him to have to use the command line to run it, because that's rather inconvenient (unless there is a way to just double-click and the command line opens the program itself..).



Thanks for your help!










share|improve this question














I was wondering if it was possible to run a selfwritten ruby program just like any other program by double-clicking an icon of some sort.



And if it's possible, how do I do it?



I wrote a little program for a friend but I don't want him to have to use the command line to run it, because that's rather inconvenient (unless there is a way to just double-click and the command line opens the program itself..).



Thanks for your help!







ruby






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 11 '18 at 13:30









Brunhilde LineBrunhilde Line

174




174







  • 1





    Creating a batch script that runs the command for them is the simple option. What OS are you/they on?

    – Carcigenicate
    Nov 11 '18 at 13:32












  • I'm on Windows 10 he should be on Windows 7

    – Brunhilde Line
    Nov 11 '18 at 13:35











  • Or you can use a 'packager' like ruby-packer

    – Axe
    Nov 11 '18 at 13:36












  • 1





    Creating a batch script that runs the command for them is the simple option. What OS are you/they on?

    – Carcigenicate
    Nov 11 '18 at 13:32












  • I'm on Windows 10 he should be on Windows 7

    – Brunhilde Line
    Nov 11 '18 at 13:35











  • Or you can use a 'packager' like ruby-packer

    – Axe
    Nov 11 '18 at 13:36







1




1





Creating a batch script that runs the command for them is the simple option. What OS are you/they on?

– Carcigenicate
Nov 11 '18 at 13:32






Creating a batch script that runs the command for them is the simple option. What OS are you/they on?

– Carcigenicate
Nov 11 '18 at 13:32














I'm on Windows 10 he should be on Windows 7

– Brunhilde Line
Nov 11 '18 at 13:35





I'm on Windows 10 he should be on Windows 7

– Brunhilde Line
Nov 11 '18 at 13:35













Or you can use a 'packager' like ruby-packer

– Axe
Nov 11 '18 at 13:36





Or you can use a 'packager' like ruby-packer

– Axe
Nov 11 '18 at 13:36












2 Answers
2






active

oldest

votes


















3














The simple answer that should work for all versions of Windows is to just create a simple batch launcher.



Create a .bat file. I usually just create a new .txt file via "right click > new > text document". Then rename it, highlight everything, including the extension, and rename it to something like run.bat. The .bat part is important. Once you rename it, the icon should change to gears. If you can't overwrite the extension, or Windows is still treating it as a text document, you'll need to either manually save it as a bat, or disable "hide file extensions" in the explorer settings so the extension can be changed.




Edit the bat file, and put into it something like:



@echo off

YOUR RUN COMMAND HERE THAT YOU WOULD NORMALLY TYPE MANUALLY

pause


Paste the command that you would normally run manually where the capital text is. The first line is so it doesn't repeat the commands back, and the pause is so if an error happens, the command prompt doesn't immediately close. This gives you a chance to read the error.




Save it and close it. Now, if you double click on the bat file, your program should run.






share|improve this answer

























  • Not necessary I already made it work, Thank you!

    – Brunhilde Line
    Nov 11 '18 at 17:38











  • @BrunhildeLine One thing I'll note with using this approach though is that bat files are often used for malicious purposes since they can automate arbitrary commands. If the person you're sending this too doesn't necessarily trust you, or have the knowledge required to read what the bat is doing, they may be sketched out having to run a bat file. If they want a nice, ready to use executable, you might need to look at a Ruby-specific approach.

    – Carcigenicate
    Nov 11 '18 at 17:49


















3














Multiple ways



  • if it's for occasional use and for one script only I would pack it
    to a Windows executable with Ocra, then you can double click
    the .exe itself or a link to it

  • same as above but use jRuby and create a .jar file, not for beginners though

  • the easiest: if you configure Windows to start/run .rb files with your ruby.exe you can double click the .rb files itself and they
    will execute, they will have the red Ruby stone icon

  • if you run a .reg file to enable drap and drop on .rb files you can combine the previous technique to drop files on the script and
    they will be the parameters to the script, see my answer here for the reg file

  • my favorite: copy the .rb to your windows "C:Usersyour_userAppDataRoamingMicrosoftWindowsSendTo"
    folder, then you can right click file(s) or folder(s) and select
    sendto and select your script, the files or folder will again be the
    parameters for your script

  • you can create a .bat or .cmd file that starts with the path to your ruby.exe and the script as parameter, use rubyw.exe if you
    don't want output





share|improve this answer






















    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53249218%2frunning-a-selfwritten-ruby-program-outside-of-an-ide%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    3














    The simple answer that should work for all versions of Windows is to just create a simple batch launcher.



    Create a .bat file. I usually just create a new .txt file via "right click > new > text document". Then rename it, highlight everything, including the extension, and rename it to something like run.bat. The .bat part is important. Once you rename it, the icon should change to gears. If you can't overwrite the extension, or Windows is still treating it as a text document, you'll need to either manually save it as a bat, or disable "hide file extensions" in the explorer settings so the extension can be changed.




    Edit the bat file, and put into it something like:



    @echo off

    YOUR RUN COMMAND HERE THAT YOU WOULD NORMALLY TYPE MANUALLY

    pause


    Paste the command that you would normally run manually where the capital text is. The first line is so it doesn't repeat the commands back, and the pause is so if an error happens, the command prompt doesn't immediately close. This gives you a chance to read the error.




    Save it and close it. Now, if you double click on the bat file, your program should run.






    share|improve this answer

























    • Not necessary I already made it work, Thank you!

      – Brunhilde Line
      Nov 11 '18 at 17:38











    • @BrunhildeLine One thing I'll note with using this approach though is that bat files are often used for malicious purposes since they can automate arbitrary commands. If the person you're sending this too doesn't necessarily trust you, or have the knowledge required to read what the bat is doing, they may be sketched out having to run a bat file. If they want a nice, ready to use executable, you might need to look at a Ruby-specific approach.

      – Carcigenicate
      Nov 11 '18 at 17:49















    3














    The simple answer that should work for all versions of Windows is to just create a simple batch launcher.



    Create a .bat file. I usually just create a new .txt file via "right click > new > text document". Then rename it, highlight everything, including the extension, and rename it to something like run.bat. The .bat part is important. Once you rename it, the icon should change to gears. If you can't overwrite the extension, or Windows is still treating it as a text document, you'll need to either manually save it as a bat, or disable "hide file extensions" in the explorer settings so the extension can be changed.




    Edit the bat file, and put into it something like:



    @echo off

    YOUR RUN COMMAND HERE THAT YOU WOULD NORMALLY TYPE MANUALLY

    pause


    Paste the command that you would normally run manually where the capital text is. The first line is so it doesn't repeat the commands back, and the pause is so if an error happens, the command prompt doesn't immediately close. This gives you a chance to read the error.




    Save it and close it. Now, if you double click on the bat file, your program should run.






    share|improve this answer

























    • Not necessary I already made it work, Thank you!

      – Brunhilde Line
      Nov 11 '18 at 17:38











    • @BrunhildeLine One thing I'll note with using this approach though is that bat files are often used for malicious purposes since they can automate arbitrary commands. If the person you're sending this too doesn't necessarily trust you, or have the knowledge required to read what the bat is doing, they may be sketched out having to run a bat file. If they want a nice, ready to use executable, you might need to look at a Ruby-specific approach.

      – Carcigenicate
      Nov 11 '18 at 17:49













    3












    3








    3







    The simple answer that should work for all versions of Windows is to just create a simple batch launcher.



    Create a .bat file. I usually just create a new .txt file via "right click > new > text document". Then rename it, highlight everything, including the extension, and rename it to something like run.bat. The .bat part is important. Once you rename it, the icon should change to gears. If you can't overwrite the extension, or Windows is still treating it as a text document, you'll need to either manually save it as a bat, or disable "hide file extensions" in the explorer settings so the extension can be changed.




    Edit the bat file, and put into it something like:



    @echo off

    YOUR RUN COMMAND HERE THAT YOU WOULD NORMALLY TYPE MANUALLY

    pause


    Paste the command that you would normally run manually where the capital text is. The first line is so it doesn't repeat the commands back, and the pause is so if an error happens, the command prompt doesn't immediately close. This gives you a chance to read the error.




    Save it and close it. Now, if you double click on the bat file, your program should run.






    share|improve this answer















    The simple answer that should work for all versions of Windows is to just create a simple batch launcher.



    Create a .bat file. I usually just create a new .txt file via "right click > new > text document". Then rename it, highlight everything, including the extension, and rename it to something like run.bat. The .bat part is important. Once you rename it, the icon should change to gears. If you can't overwrite the extension, or Windows is still treating it as a text document, you'll need to either manually save it as a bat, or disable "hide file extensions" in the explorer settings so the extension can be changed.




    Edit the bat file, and put into it something like:



    @echo off

    YOUR RUN COMMAND HERE THAT YOU WOULD NORMALLY TYPE MANUALLY

    pause


    Paste the command that you would normally run manually where the capital text is. The first line is so it doesn't repeat the commands back, and the pause is so if an error happens, the command prompt doesn't immediately close. This gives you a chance to read the error.




    Save it and close it. Now, if you double click on the bat file, your program should run.







    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Nov 11 '18 at 16:11

























    answered Nov 11 '18 at 13:42









    CarcigenicateCarcigenicate

    17.6k43158




    17.6k43158












    • Not necessary I already made it work, Thank you!

      – Brunhilde Line
      Nov 11 '18 at 17:38











    • @BrunhildeLine One thing I'll note with using this approach though is that bat files are often used for malicious purposes since they can automate arbitrary commands. If the person you're sending this too doesn't necessarily trust you, or have the knowledge required to read what the bat is doing, they may be sketched out having to run a bat file. If they want a nice, ready to use executable, you might need to look at a Ruby-specific approach.

      – Carcigenicate
      Nov 11 '18 at 17:49

















    • Not necessary I already made it work, Thank you!

      – Brunhilde Line
      Nov 11 '18 at 17:38











    • @BrunhildeLine One thing I'll note with using this approach though is that bat files are often used for malicious purposes since they can automate arbitrary commands. If the person you're sending this too doesn't necessarily trust you, or have the knowledge required to read what the bat is doing, they may be sketched out having to run a bat file. If they want a nice, ready to use executable, you might need to look at a Ruby-specific approach.

      – Carcigenicate
      Nov 11 '18 at 17:49
















    Not necessary I already made it work, Thank you!

    – Brunhilde Line
    Nov 11 '18 at 17:38





    Not necessary I already made it work, Thank you!

    – Brunhilde Line
    Nov 11 '18 at 17:38













    @BrunhildeLine One thing I'll note with using this approach though is that bat files are often used for malicious purposes since they can automate arbitrary commands. If the person you're sending this too doesn't necessarily trust you, or have the knowledge required to read what the bat is doing, they may be sketched out having to run a bat file. If they want a nice, ready to use executable, you might need to look at a Ruby-specific approach.

    – Carcigenicate
    Nov 11 '18 at 17:49





    @BrunhildeLine One thing I'll note with using this approach though is that bat files are often used for malicious purposes since they can automate arbitrary commands. If the person you're sending this too doesn't necessarily trust you, or have the knowledge required to read what the bat is doing, they may be sketched out having to run a bat file. If they want a nice, ready to use executable, you might need to look at a Ruby-specific approach.

    – Carcigenicate
    Nov 11 '18 at 17:49













    3














    Multiple ways



    • if it's for occasional use and for one script only I would pack it
      to a Windows executable with Ocra, then you can double click
      the .exe itself or a link to it

    • same as above but use jRuby and create a .jar file, not for beginners though

    • the easiest: if you configure Windows to start/run .rb files with your ruby.exe you can double click the .rb files itself and they
      will execute, they will have the red Ruby stone icon

    • if you run a .reg file to enable drap and drop on .rb files you can combine the previous technique to drop files on the script and
      they will be the parameters to the script, see my answer here for the reg file

    • my favorite: copy the .rb to your windows "C:Usersyour_userAppDataRoamingMicrosoftWindowsSendTo"
      folder, then you can right click file(s) or folder(s) and select
      sendto and select your script, the files or folder will again be the
      parameters for your script

    • you can create a .bat or .cmd file that starts with the path to your ruby.exe and the script as parameter, use rubyw.exe if you
      don't want output





    share|improve this answer



























      3














      Multiple ways



      • if it's for occasional use and for one script only I would pack it
        to a Windows executable with Ocra, then you can double click
        the .exe itself or a link to it

      • same as above but use jRuby and create a .jar file, not for beginners though

      • the easiest: if you configure Windows to start/run .rb files with your ruby.exe you can double click the .rb files itself and they
        will execute, they will have the red Ruby stone icon

      • if you run a .reg file to enable drap and drop on .rb files you can combine the previous technique to drop files on the script and
        they will be the parameters to the script, see my answer here for the reg file

      • my favorite: copy the .rb to your windows "C:Usersyour_userAppDataRoamingMicrosoftWindowsSendTo"
        folder, then you can right click file(s) or folder(s) and select
        sendto and select your script, the files or folder will again be the
        parameters for your script

      • you can create a .bat or .cmd file that starts with the path to your ruby.exe and the script as parameter, use rubyw.exe if you
        don't want output





      share|improve this answer

























        3












        3








        3







        Multiple ways



        • if it's for occasional use and for one script only I would pack it
          to a Windows executable with Ocra, then you can double click
          the .exe itself or a link to it

        • same as above but use jRuby and create a .jar file, not for beginners though

        • the easiest: if you configure Windows to start/run .rb files with your ruby.exe you can double click the .rb files itself and they
          will execute, they will have the red Ruby stone icon

        • if you run a .reg file to enable drap and drop on .rb files you can combine the previous technique to drop files on the script and
          they will be the parameters to the script, see my answer here for the reg file

        • my favorite: copy the .rb to your windows "C:Usersyour_userAppDataRoamingMicrosoftWindowsSendTo"
          folder, then you can right click file(s) or folder(s) and select
          sendto and select your script, the files or folder will again be the
          parameters for your script

        • you can create a .bat or .cmd file that starts with the path to your ruby.exe and the script as parameter, use rubyw.exe if you
          don't want output





        share|improve this answer













        Multiple ways



        • if it's for occasional use and for one script only I would pack it
          to a Windows executable with Ocra, then you can double click
          the .exe itself or a link to it

        • same as above but use jRuby and create a .jar file, not for beginners though

        • the easiest: if you configure Windows to start/run .rb files with your ruby.exe you can double click the .rb files itself and they
          will execute, they will have the red Ruby stone icon

        • if you run a .reg file to enable drap and drop on .rb files you can combine the previous technique to drop files on the script and
          they will be the parameters to the script, see my answer here for the reg file

        • my favorite: copy the .rb to your windows "C:Usersyour_userAppDataRoamingMicrosoftWindowsSendTo"
          folder, then you can right click file(s) or folder(s) and select
          sendto and select your script, the files or folder will again be the
          parameters for your script

        • you can create a .bat or .cmd file that starts with the path to your ruby.exe and the script as parameter, use rubyw.exe if you
          don't want output






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 11 '18 at 13:58









        peterpeter

        35.8k44985




        35.8k44985



























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53249218%2frunning-a-selfwritten-ruby-program-outside-of-an-ide%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

            Crossroads (UK TV series)

            ữḛḳṊẴ ẋ,Ẩṙ,ỹḛẪẠứụỿṞṦ,Ṉẍừ,ứ Ị,Ḵ,ṏ ṇỪḎḰṰọửḊ ṾḨḮữẑỶṑỗḮṣṉẃ Ữẩụ,ṓ,ḹẕḪḫỞṿḭ ỒṱṨẁṋṜ ḅẈ ṉ ứṀḱṑỒḵ,ḏ,ḊḖỹẊ Ẻḷổ,ṥ ẔḲẪụḣể Ṱ ḭỏựẶ Ồ Ṩ,ẂḿṡḾồ ỗṗṡịṞẤḵṽẃ ṸḒẄẘ,ủẞẵṦṟầṓế