473,422 Members | 2,199 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,422 software developers and data experts.

Pass a Parameter to an .exe

polymorphic
I need to pass a parameter to an executable either via URL or link or script or whatever but nothing is working.

The .exe is: \\CL001\Mart\OP2\Test1.exe

The parameter is: '\\CL001\mart\op2\Test'

A direct type of this in the URL works:

\\CL001\Mart\OP2\Test1.exe /p '\\CL001\mart\op2\Test'

However, if I type this (\\CL001\Mart\OP2\Test1.exe /p '\\CL001\mart\op2\Test') into a link for a URL, then the "file:\\" prefix is placed before and file not found error occurs.

This opens the app but the parameter is not passed properly:
<A HREF="\\CL001\Mart\OP2\Test1.exe?'p=\\CL001\mart\o p2\Test''"></A>

I've tried various javascripts and manipulations with no success. Anyone have an idea?

Thanks,
cj
Dec 10 '07 #1
13 12771
acoder
16,027 Expert Mod 8TB
Have you tried setting location.href?
Dec 11 '07 #2
Thanks the response. I have tried location.href but get the error "Object Expected":

Expand|Select|Wrap|Line Numbers
  1. <SCRIPT LANGUAGE="javascript">
  2.  
  3. function PROCTest() {
  4.  document.location.href =  document.location.href = "\\\\CL001\\Mart\\OP2\\Test1.exe%20'"'\\\\CL001\mart\op2\Test'"'";
  5. }
  6.  
  7. </SCRIPT>
  8. <html>
  9. <head>
  10. <title></title>
  11. </head>
  12. <body ONLOAD = 'PROCTest()'>
  13.   test
  14. </body>
  15. </html>
Dec 11 '07 #3
Thanks the response. I have tried location.href but get the error "Object Expected":

Expand|Select|Wrap|Line Numbers
  1. <SCRIPT LANGUAGE="javascript">
  2.  
  3. function PROCTest() {
  4.  document.location.href =  document.location.href = "\\\\CL001\\Mart\\OP2\\Test1.exe%20'"'\\\\CL001\mart\op2\Test'"'";
  5. }
  6.  
  7. </SCRIPT>
  8. <html>
  9. <head>
  10. <title></title>
  11. </head>
  12. <body ONLOAD = 'PROCTest()'>
  13.   test
  14. </body>
  15. </html>
May be if the application has a command line interface, you can pass arguments using a wshshell object or a batch file. You will be able to return the output of the command if you need.

You can do this in javascript or PHP. Just search for Wshshell for javascript.
I am fairly new to this so please give it a try and if it works please let me know.

Good Luck!
Dec 12 '07 #4
The code below almost works. The app starts up but then will not accept the parameter properly. I get the message that path "\\CL001\\Mart\\op2\\Test" does not exist.

Like I had mentioned before, in the command line I have to use a /p to properly pass the parameter: \\CL001\Mart\OP2\Test1.exe /p '\\CL001\mart\op2\Test'


Expand|Select|Wrap|Line Numbers
  1. <HTML>
  2. <SCRIPT
  3.  language = "javascript"> 
  4. function PROCRun() {
  5.  var shell = new ActiveXObject("WScript.Shell");
  6.  shell.run( '"\\\\CL001\\Mart\\OP2\\Test1.exe" "\\\\CL001\\Mart\\op2\\Test"' , 1, true );
  7.  window.close();
  8. }
  9. </SCRIPT>
  10. <BODY
  11.   ONLOAD='
  12.    PROCRun();
  13.   '
  14. >
  15. </BODY>
  16. </HTML>
Dec 13 '07 #5
acoder
16,027 Expert Mod 8TB
Thanks the response. I have tried location.href but get the error "Object Expected":
That should be window.location.href or simply location.href, not document.location.href.
Dec 13 '07 #6
acoder
16,027 Expert Mod 8TB
The code below almost works. The app starts up but then will not accept the parameter properly. I get the message that path "\\CL001\\Mart\\op2\\Test" does not exist.

Like I had mentioned before, in the command line I have to use a /p to properly pass the parameter: \\CL001\Mart\OP2\Test1.exe /p '\\CL001\mart\op2\Test'
Perhaps you could try passing the string as it works to shell.run.
Dec 13 '07 #7
rnd me
427 Expert 256MB
[quote=JohnDriver]

document.location.href = document.location.href = "\\\\CL001\\Mart\\OP2\\Test1.exe%20'"'\\\\CL001\ma rt\op2\Test'"'";
</
/QUOTE]

that should be window.location.href...
Dec 13 '07 #8
That gives me two errors:

1. Expected ";" @
Expand|Select|Wrap|Line Numbers
  1. function PROCTest() 
2. Object Expected @
Expand|Select|Wrap|Line Numbers
  1. <body ONLOAD="PROCTest()">

Expand|Select|Wrap|Line Numbers
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
  2. <SCRIPT TYPE = "text/javascript">
  3.  
  4. function PROCTest() {
  5.  window.location.href = "\\\\BABBROFFIL001\\Groups\\OPIM\\BrewSchd.exe%20'"'\\\\BABBROFFIL001\\Groups\\opim\\Sched'"'";
  6. }
  7.  
  8. </SCRIPT>
  9. <html>
  10.     <head>
  11.         <title></title>
  12.     </head>
  13.     <body ONLOAD="PROCTest()">
  14.     test
  15.     </body>
  16. </html>
Dec 13 '07 #9
rnd me
427 Expert 256MB
That gives me two errors:
"\\\\BABBROFFIL001\\Groups\\OPIM\\BrewSchd.exe%20' "'\\\\BABBROFFIL001\\Groups\\opim\\Sched'"'";
you have nested quotations that are not connected by "+", or escaped.

this is invalid. escape the quotes or connect the substrings...
Dec 14 '07 #10
davez
3
hi

I'm very new in this...

I tried in my app something similar (open a shell), currently i'm connecting via localhost and my question is: if i want to run an exe/bat file (using a shell or whatever) on the server, will it work, or do I need to use PHP or something?

similarily, what does the "runat" tag mean exactly?

thanks

Dave
Dec 27 '07 #11
acoder
16,027 Expert Mod 8TB
Welcome to TSDN!
I tried in my app something similar (open a shell), currently i'm connecting via localhost and my question is: if i want to run an exe/bat file (using a shell or whatever) on the server, will it work, or do I need to use PHP or something?
If it's on the server, use a server-side scripting language such as PHP, ASP, JSP, Coldfusion, Perl, etc.
similarily, what does the "runat" tag mean exactly?
That sounds like some .NET thing. Either google for it or ask in the .NET forum.
Dec 27 '07 #12
davez
3
thanks for your response! i'll try
Dec 27 '07 #13
acoder
16,027 Expert Mod 8TB
You're welcome and good luck in coding your application!
Dec 27 '07 #14

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

Similar topics

2
by: Yarik | last post by:
Hello there! I am working with MS SQL Server 2000. I have a table function that takes an integer parameter and returns a table, and I can successfully use it like this (passing a literal as a...
7
by: Zlatko Matić | last post by:
Let's assume that we have a database on some SQL server (let it be MS SQL Server) and that we want to execute some parameterized query as a pass.through query. How can we pass parameters to the...
0
by: Zlatko Matić | last post by:
Hi everybody! Recently I was struggling with client/server issues in MS Access/PostgreSQL combination. Although Access is intuitive and easy to use desktop database solution, many problems...
1
by: Dion Heskett | last post by:
How can I pass a Class as a parameter to in a method ? i.e. Private myMethod( string pram1, Classobject as pram2) { Classobject.DataSource = reader; Classobject.DataBind(); }
9
by: Jay Douglas | last post by:
Hello, I am needing to pass a class object (this) by reference to a method in a different class. When I do the following code I get the error (Cannot pass '<this>' as a ref or out argument because...
1
by: | last post by:
Hi, I've defined an ObjectDataSource and a parameterized DataSet. I would like it if I could pass the parameter value that describes the query that creates the DataSet as part of a user control...
3
by: Brett | last post by:
I have several classes that create arrays of data and have certain properties. Call them A thru D classes, which means there are four. I can call certain methods in each class and get back an...
4
by: _Mario.lat | last post by:
Hallo, I have a little question: In the function session_set_save_handler I can pass the name of function which deal with session. In Xoops code I see the use of this function like that: ...
5
by: David++ | last post by:
Hi folks, I would be interested to hear peoples views on whether or not 'pass by reference' is allowed when using a Web Service method. The thing that troubles me about pass-by-reference into...
12
by: raylopez99 | last post by:
Keywords: scope resolution, passing classes between parent and child forms, parameter constructor method, normal constructor, default constructor, forward reference, sharing classes between forms....
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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...
0
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
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
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
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
isladogs
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...

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.