473,499 Members | 1,672 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Calling 'system()' ... with parameters

39 New Member
Hi everyone,

I have a perl script that opens an Access mdb thus:

system("C:\\Documents\ and\ Settings\\asearle\\My\ Documents\\iwh_dev\\MyAccessDB.mdb");

This works absolutely fine and, indeed, the perl script happily terminates cleanly when I close the external application.

Now I would like to implement more automation by adding parameters to the system() call. I need to add the following two parameters:

/runtime (to start Access in runtime mode)
/cmd startfull (to pass the command parameter 'startfull' as text)

I tried tagging these commands on the end of my basic command thus:

... MyAccessDB.mdb\ \/runtime\ \/cmd\ starttest");

but perl simply complained that the file could not be found (i.e. the parameters were interpreted as part of the file name of the file to be called).

So my question now is whether these parameters need to be passed as separate arguments to the system() call?

Any tips here would be a great help.

Regards,
Alan Searle.
Nov 23 '06 #1
4 3746
asearle
39 New Member
I did some more googling and found the syntax for passing arguments:

@args = ("command", "arg1", "arg2");
system(@args) == 0
or die "system @args failed: $?"

Excellent!

But when I tried incorporating this into my command thus:

... \\IWH_Rep_Qukam.mdb", "\/runtime", "\/cmd starttest"

either directly in the system() call or first into the @args array, I found that the program (the Access mdb) would open but none of the parameters that I wanted to pass were recognised.

Has anyone got a tip here? Maybe there is an error in my syntax?

Any tips or recommendations would be greatly appreciated.

Regards,
Alan Searle.
Nov 23 '06 #2
GunnarH
83 New Member
But when I tried incorporating this into my command thus:

... \\IWH_Rep_Qukam.mdb", "\/runtime", "\/cmd starttest"

either directly in the system() call or first into the @args array, I found that the program (the Access mdb) would open but none of the parameters that I wanted to pass were recognised.
I would try without those backslashes:
Expand|Select|Wrap|Line Numbers
  1. ... \\IWH_Rep_Qukam.mdb", "\/runtime", "\/cmd starttest"
  2. ---------------------------^------------^
Or, as regards the first attempt, I'd not escape the space characters that serve as argument separators:
Expand|Select|Wrap|Line Numbers
  1. ... MyAccessDB.mdb\ \/runtime\ \/cmd\ starttest");
  2. ------------------^----------^
Nov 23 '06 #3
asearle
39 New Member
Thanks very much for the tips.

Yes, I have played around with all kinds of variations with and without escape characters and with and without spaces and with various different start parameters. I have also 'debug-printed' the variables to check that they are getting to the system() command.

But somehow they are simply not applied in the windows environment.

Is this a quirky thing specific to windows (or to ... arrggghhh ... MicroS**t)? Or is it me? I'm not sure.

Anyway, the new path that I have decided to take is to do away with all parameters (one less thing for the guys in production to worry about) and to apply a 'time controlled default'. This will work in the following way:

The system will be started by the Perl script (without options) and will hold for about 10 seconds in which time a manual user can cancel the automated processing. If no cancellation is received then the automated process will start.

I feel quite happy with this solution but it doesn't solve the problem with the passing of parameters (to a windows program).

I'd be very interested to know if anyone else has experience of successfully passing parameters to other windows programs via the system() command?

Many thanks,
Alan Searle.
Nov 24 '06 #4
GunnarH
83 New Member
I'd be very interested to know if anyone else has experience of successfully passing parameters to other windows programs via the system() command?
I have - without backslashes.
Nov 24 '06 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

2
4731
by: Shailan | last post by:
Hi Im having trouble with the following code that seems to be behave differently when called from the browser as opposed to the command line. The calling script is a cgi that forks, with the...
0
1871
by: Error while executing SP | last post by:
Hi, I am getting an error while executing a sp from Oracle database. Can you let me know what could be the problem? here is the code using(System.Data.OleDb.OleDbConnection cn = new...
16
2271
by: aarklon | last post by:
Hi folks, recently i read the book named assembly language step by step by Jeff Duntemann. in the chapter coding for linux, he has got a paragraph named C calling conventions, which he...
3
4718
by: Webdiyer | last post by:
I want to integrate SecurID two-factor authentication system of the RSASecurity.inc into our asp.net application,but I get into trouble when trying to call the API functions of the ACE Agent,I got...
2
1881
by: anoop | last post by:
Hello, I created a Public class in .aspx.vb code behind file, now I want to know can I call that functions in the class in the Scripts either client side or server side in .aspx page. also I want...
0
2231
by: Cleo | last post by:
Hi, I am trying to call a WebService Method written in Weblogic from VB.NET and I am getting the following error. I am using SOAP Caal s from VB.NET. Please find the wsdl file and my code. ...
7
3068
by: Jorgen Haukland, Norway | last post by:
Hi, I have created a Java webservice which runs in IBM WebSphere appserver. I take the WSDL-file and create a VS.NET WinForm application and calls the service running on my PC and everything...
1
2323
by: Phil Mc | last post by:
Trying to call a stored proc but some times don't want to have values inserted in some fields. Hi I am rewriting a VBS script which called a stored proc in a SQL server db. The proc takes a...
10
3233
by: sulekhasweety | last post by:
Hi, the following is the definition for calling convention ,which I have seen in a text book, can anyone give a more detailed explanation in terms of ANSI - C "the requirements that a...
0
13284
amitpatel66
by: amitpatel66 | last post by:
There is always a requirement that in Oracle Applications, the Concurrent Program need to be execute programatically based on certain conditions/validations: Concurrent programs can be executed...
0
7131
marktang
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,...
0
7174
Oralloy
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,...
0
7220
jinu1996
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...
0
7388
tracyyun
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...
0
5470
agi2029
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,...
0
4600
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3099
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3091
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
297
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.