Ruby Windows

Launching Windows EXE Software from External Command in Ruby

Notes on how to launch Windows exe software from external commands in the Ruby programming language. Using Ruby's Open3.popen3. Below are the ones that resulted in errors and finally the one that worked successfully.

Shou Arisaka
1 min read
Oct 5, 2025

Notes on how to launch Windows exe software from external commands in the Ruby programming language. Using Rubyโ€™s Open3.popen3. Below are the ones that resulted in errors and finally the one that worked successfully.

require "open3"

# Open3.popen3('. "C:/Program Files/AutoHotkey/AutoHotkeyU64.exe" "C:/pg/autohotkey/traytip.ahk"') do |i, o, e, w| # => Error
# Open3.popen3('. "C:/Program Files/AutoHotkey/AutoHotkeyU64.exe" "C:/pg/sinatra/_tmp/traytip.ahk"') do |i, o, e, w| # => Error
# Open3.popen3('Set-Alias ahk "C:/Program Files/AutoHotkey/AutoHotkeyU64.exe" ; ahk "C:/pg/sinatra/_tmp/traytip.ahk"') do |i, o, e, w| # => Error
# Open3.popen3(%(powershell -Command 'ahk "C:/pg/sinatra/_tmp/traytip.ahk"')) do |i, o, e, w| # => Error
# Open3.popen3(%(ahk "C:/pg/sinatra/_tmp/traytip.ahk")) do |i, o, e, w| # => Error
# # It worked.
# Open3.popen3(%(cmd /c start "" C:/pg/SetClipboardWithBtn/build/SetClipboardWithBtn.jar")) do |i, o, e, w| # => Opens with associated middleware software. No need to specify autohotkey.
Open3.popen3(%(cmd /c start "" notepad.exe "C:/pg/autohotkey/traytip.ahk")) do |i, o, e, w| # => Opens with specified software

end

With this, it becomes possible to perform actions on the Windows side when an HTTP request is made to the server.

Share this article

Shou Arisaka Oct 5, 2025

๐Ÿ”— Copy Links