Hi All,
Is there anyway i can call windows Batch file from ruby program.
I tried the following line, it failed :
cmd.exe /c C:\Documents and Settings\user\D esktop\RUN.bat
Suggest me if you have an answer for this.
Cheers
6 21853 - system('path/to/file.bat')
The system call will let you do things similar to how you would do them with cmd.
- system('path/to/file.bat')
The system call will let you do things similar to how you would do them with cmd.
Thanks improvcornartis t !!, It works great :)
I see your the only one actively answering Q's.
Thanks
I don't think there are many Ruby/Rails users around here. I'm pretty new to it myself, but I try to help out where I can.
Just a note on using the system call - it will return true or false, depending whether it runs successfully or not. So, you can use it as a test of sorts. -
if system(file.bat)
-
#the bat file ran, so do this
-
else
-
#it didn't run successfully, so I need to do this instead
-
end
-
I don't think there are many Ruby/Rails users around here. I'm pretty new to it myself, but I try to help out where I can.
Just a note on using the system call - it will return true or false, depending whether it runs successfully or not. So, you can use it as a test of sorts. -
if system(file.bat)
-
#the bat file ran, so do this
-
else
-
#it didn't run successfully, so I need to do this instead
-
end
-
Hi improvcornartis t,
I have one doubt pertaining to system call and starting my server.
I use the system call --> system("D:\ruby \bin\selenium.c md")
This starts a server followed by which i would be calling all the methods in my code.
But until the first part of system call ends, i am not able to go to successive methods.
I cant stop the server and then start calling other methods since all methods require server to be up & running.
My question is , Can i start the server and keep it active plus it comes out of the system call and start executing other methods respectively.
Thanks in Advance
I'm not sure how to do this. You might be able to start a new thread. - Thread.new{system("D:\ruby\bin\selenium.cmd")}
I don't know if that will work, but I'm not sure what else to try. I might have to research this; I would be interested to know how to do it.
I'm not sure how to do this. You might be able to start a new thread. - Thread.new{system("D:\ruby\bin\selenium.cmd")}
I don't know if that will work, but I'm not sure what else to try. I might have to research this; I would be interested to know how to do it.
Hi,
I tried using Thread.new(syst em('D:\ruby\bin \selenium.cmd') ), it doesnt seem to do what i want, i will be on the watchout , if i find any answers will be updating here!!
cheers
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Mark C. |
last post by:
I'm trying to call a batch file that I've built using the FileSystemObject
and CreateObject("Wscript.Shell"), oShell.Run... in an asp script.
Naturally, I can get the script to work from a command line but not from a
browser. The page does not throw an error but the oShell.Run... portion of
the script doesn't run. Any help would be appreciated. Thanks.
|
by: Bucky Pollard |
last post by:
I have a web service that needs to create a batch file and call it (since
there are no APIs for the functionality I am looking for). I am using the
Process and ProcessStartInfo objects. When I try to call the batch file, it
just returns with a return code of 1. When I call cmd.exe, and pass the
batch file as a parameter it hangs. After much frustration and aggrevation,
I found that CMD IS in fact running, but it is running under the context...
|
by: JoelBrimm |
last post by:
I have a batch file that executes a command line utility to do a secure file
copy from our server to a 3rd party server. The batch file works fine, but
when I call it from the web service the log file shows that it hangs up on
the execution of the utility ( an exe ).
Batch files without an exe work fine.
I also tried running the exe from the web service ( rc =
shell(application,hide,true) ) but it didn't work either.
|
by: MLH |
last post by:
I have a batch file named GetConf.bat.
It contains a line like this:
ipconfig /all >c:\MyAppDir\IPdata.txt
I believe I could run the line with something
like ShellWait by Terry Kreft. Any reason I
should run the procedure via a batch file
call as opposed to launching the command
string directly?
|
by: eric.goforth |
last post by:
Hello,
I have a simple batch file that I'm trying to call from a VB.NET
application:
@ECHO OFF
IF (%1)==() GOTO END
DIR %1 > MYDIR.TXT
:END
@ECHO ON
| |
by: gabrielk43 |
last post by:
Hi to all,
I have made a web service which creates a batch file in a folder in web server and tries to execute it (in a Windows Server 2003 web server). So far I have managed to create the batch file successfully by adjusting the permissions of the folder it is created in, for the user which is assigned to run the web application for the specific application pool. But when the web service tries to execute the newly created batch file (using...
|
by: Studlyami |
last post by:
Hey all, I'm trying to create a simple (I think it should be simple) batch file. I want this file to open Internet Explorer 6 go to the webpage SIRIUS Satellite Radio - The Best Radio On Radio and run the javascript: launchPlayer(",",","); Is this possible? I don't know anything about batch files and i only got to the point where i can open the webpage, but i am unable to open it in IE.
I tried
START "C:\Program Files\Internet...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |