473,769 Members | 2,124 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Pass a Parameter to an .exe

polymorphic
28 New Member
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\OP 2\Test1.exe

The parameter is: '\\CL001\mart\o p2\Test'

A direct type of this in the URL works:

\\CL001\Mart\OP 2\Test1.exe /p '\\CL001\mart\o p2\Test'

However, if I type this (\\CL001\Mart\O P2\Test1.exe /p '\\CL001\mart\o p2\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\M art\OP2\Test1.e xe?'p=\\CL001\m art\op2\Test''" ></A>

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

Thanks,
cj
Dec 10 '07 #1
13 12841
acoder
16,027 Recognized Expert Moderator MVP
Have you tried setting location.href?
Dec 11 '07 #2
polymorphic
28 New Member
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
JohnDriver
23 New Member
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
polymorphic
28 New Member
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\OP 2\Test1.exe /p '\\CL001\mart\o p2\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 Recognized Expert Moderator MVP
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.locati on.href.
Dec 13 '07 #6
acoder
16,027 Recognized Expert Moderator MVP
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\OP 2\Test1.exe /p '\\CL001\mart\o p2\Test'
Perhaps you could try passing the string as it works to shell.run.
Dec 13 '07 #7
rnd me
427 Recognized Expert Contributor
[quote=JohnDrive r]

document.locati on.href = document.locati on.href = "\\\\CL001\\Mar t\\OP2\\Test1.e xe%20'"'\\\\CL0 01\mart\op2\Tes t'"'";
</
/QUOTE]

that should be window.location .href...
Dec 13 '07 #8
polymorphic
28 New Member
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 Recognized Expert Contributor
That gives me two errors:
"\\\\BABBROFFIL 001\\Groups\\OP IM\\BrewSchd.ex e%20'"'\\\\BABB ROFFIL001\\Grou ps\\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

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

Similar topics

2
2441
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 parameter): SELECT * FROM MyTableFunction(1)
7
21634
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 server ? Is it possible to use parameters in pass-through queries ? An additional question: Is it possible to connect to a database on MySQL or PostgreSQL using ADO ? Is it possible to execute pass-through queries with parameters, using ADO...
0
3322
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 appear when someone is trying to use it as front-end for real server database systems such as PostgreSQL or MySQL. One of these problems is regarding pass-through queries and parameters. I wanted to have all the code on client, while executing it on...
1
23658
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
12875
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 it is read-only) .. Is there any way to make <this> not read-only? I have simplified the following code. There is a Task class and a Data Class. I am trying to pass the task class by ref to the data class. public class Task {
1
7758
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 declaration. Here's how the parameter is described in the context of my ObjectDataSource: <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" SelectMethod="GetArticlesByWhomever" TypeName="WhateverTableAdapters.WhateverTableAdapter">
3
5491
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 array of data. All four classes are the same except for the number of elements in their arrays and the data. I have a MainClass (the form), which processes all of these arrays. The MainClass makes use of third party objects to do this. There...
4
156066
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: session_set_save_handler(array(&$sess_handler, 'open'), array(&$sess_handler, 'close'), array(&$sess_handler, 'read'), array(&$sess_handler, 'write'), array(&$sess_handler, 'destroy'), array(&$sess_handler, 'gc'));
5
7822
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 a WebService is that essentially we are passing an address of an object which resides on the 'local machine' i.e. a local machine object address. Surely when the WebService method is called and run 'on the server', the reference type will be...
12
11109
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. Here is a newbie mistake that I found myself doing (as a newbie), and that even a master programmer, the guru of this forum, Jon Skeet, missed! (He knows this I'm sure, but just didn't think this was my problem; LOL, I am needling him) If...
0
9423
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,...
0
10210
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, 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...
0
10039
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 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...
0
9860
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 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...
0
6668
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5297
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5445
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3560
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2814
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.