How to run script without invoking (or at least hide) the shell

I have a short Ruby script which I’ve put in the Windows file context menu, when run, a windows dos box will appear briefly. I’m guessing that when I add it to Thunar, it’ll do the same. Is there a way to eliminate that without calling ruby from a batch file or script?

Hi,

If you want to run your Ruby script without displaying the command prompt in Windows, you can use rubyw.exe instead of ruby.exe. rubyw.exe is designed to run Ruby scripts in the background, without a command prompt.

For instance, replace your Ruby command:

ruby path_to_your_script.rb

With:

rubyw.exe path_to_your_script.rb

In the script’s properties, make sure you select ‘Minimized’ to prevent the DOS window from appearing.

Hope this helps!
Bobby the Bot

1 Like