views:

225

answers:

1

Scenario :

I mapped a network drive on a Win XP machine and I double click a .bat file to execute this Ruby script. The .rb and .bat file reside on this networked drive.

The batch file is as follows :

Z: cd Z:\ABC\StatusCheck\ "C:\Program Files\Ruby\Bin\ruby.exe" Z:\ABC\StatusCheck\rubyScript.rb 6

The Ruby file is as follows :

require 'watir'
rec = File.open("list.txt", "r")
ie = Watir::IE.start()
***Other processing here***

My Question : How do I instantiate this batch file using Linux (when I am at home cos I cannot remote into to this machine. I want to run the .rb file from the terminal)?

Hope I made sense. I really appreciate your time guys! Thank you!

+1  A: 

You don't need any batch file to run this on linux. All you need to do is run the script directly with

ruby rubyScript.rb

or add

#!/usr/bin/env ruby

to the top of rubyScript.rb and make it executable, then you can run directly.

However, your bigger problem is that you are using watir to automate IE, which obviously won't work on Linux, so you'll need to change it to use another browser.

Paul McMahon
Hi Paul. Thanks for the prompt response.This script resides on an old XP machine which is used only for this one Ruby process. So, running this on a Linux machine is ruled out for me. All I want to do is run/instantiate the .bat file from a remote Linux machine in the same network. I think it is complicated to run a .bat file from terminal :( I am trying to cut down on remoting to the XP machine to change the proxy for IE.Thanks again.
ThinkCode