473,508 Members | 2,335 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Script to open a DOS Command Window and run exe on client (INTRANET)

Hi,

I have an asp.net app running on an Intranet. From one of my aspx
pages I would like to run a javascript that will run the following
command OUTSIDE of the IIS/asp.net environment on the CLIENT machine
(remember, a controlled Intranet!). Is this possible? This windows
program needs to be opened and data entered periodically while using
the asp.net app as well.

The exe runs in a dos command window, tied to a Citrix ica file.

C:\Program Files\Citrix\ICA Client\wfica32.exe ciq.ica

PLEASE help me...the boss really wants this!

Thanks,

Kathy
Jul 20 '05 #1
11 78060
In article <75**************************@posting.google.com >,
Ka**********@attbi.com enlightened us with...
Hi,

I have an asp.net app running on an Intranet. From one of my aspx
pages I would like to run a javascript that will run the following
command OUTSIDE of the IIS/asp.net environment on the CLIENT machine
(remember, a controlled Intranet!). Is this possible?


You can use an HTA for this (jscript or vbscript).
They run on the client.

"Normal" javascript, as in just a link to the application/exe or a
window.open, would require a browser environment.
You could have a link in the aspx page that points to your hta, which
opens the process and shows the dos window.

<a href="myHTA.hta">Click here for process</a>

HTA documentation:
http://msdn.microsoft.com/workshop/a...taoverview.asp

--
--
~kaeli~
I do whatever my Rice Krispies tell me to.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 20 '05 #2
Lee
KathyB said:

Hi,

I have an asp.net app running on an Intranet. From one of my aspx
pages I would like to run a javascript that will run the following
command OUTSIDE of the IIS/asp.net environment on the CLIENT machine
(remember, a controlled Intranet!). Is this possible? This windows
program needs to be opened and data entered periodically while using
the asp.net app as well.

The exe runs in a dos command window, tied to a Citrix ica file.

C:\Program Files\Citrix\ICA Client\wfica32.exe ciq.ica

PLEASE help me...the boss really wants this!

IE only:
var shell=new ActiveXObject("WScript.Shell");
shell.Run("cmd /K CD C:\ & Dir", 1);

peeve:
It is not "a javascript", any more than a Java program is "a Java".

Jul 20 '05 #3
Lee, I tried this but get an IE6 error that a ";" is expected...at
position 15 but that doesn't make sense.

Specifically, from an onclick event in aspx page, I have

Response.Write("<script>var shell=new
ActiveXObject(""WScript.Shell"");shell.Run(""cmd /K CD C:\\Program
Files\\Citrix\\ICA Client\\wfica32.exe ciq.ica"", 1);</script>")

I see the script in the html source when I run it, but I get the error
as mentioned above. Any thoughts?

Thanks for your help.

Kathy

p.s. what does the "1" do at the end of the shell.run line?

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 20 '05 #4
kaeli,

First, I trust anyone who listens to their rice krispies!

Although I've never used it, this seems like a great idea. I created an
hta page (that I open from the button onclick event in aspx page) and
put in an onload javascript:

function openCIQ() {
var shell=new ActiveXObject("WScript.Shell");
shell.Run("C:\\Program Files\\Citrix\\ICA Client\\wfica32.exe ciq.ica",
1); }

I get prompted for the File Download (Open/Save, etc.)

When clicked, I get an error message that the ica file can not be found.
I suspect it's looking for the file on my http local host instead of the
c: directory?

Anyhow, any ideas of where I may be going wrong?

Thanks again.

Kathy

Kathy

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 20 '05 #5
In article <3f***********************@news.frii.net>, kathyburke40
@attbi.com enlightened us with...
kaeli,

First, I trust anyone who listens to their rice krispies!

hehe

function openCIQ() {
var shell=new ActiveXObject("WScript.Shell");
shell.Run("C:\\Program Files\\Citrix\\ICA Client\\wfica32.exe ciq.ica",
1); }

I get prompted for the File Download (Open/Save, etc.)

Try
var shell = WScript.CreateObject("Wscript.Shell");
instead of ActiveX. With an HTA, you don't need ActiveX. Less overhead,
I think, too.
When clicked, I get an error message that the ica file can not be found.
I suspect it's looking for the file on my http local host instead of the
c: directory?

Anyhow, any ideas of where I may be going wrong?


It's an oddity with the quotes because of the space in the "Program
Files".
In VBScript, I'd do
shell.Run """C:\\Program Files\\Citrix\\ICA Client\\wfica32.exe
ciq.ica"""

I'm not sure how it goes in JScript. If you can't get it, get the space
out using DOS filename for Program Files with the tilde.

--
--
~kaeli~
I do whatever my Rice Krispies tell me to.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 20 '05 #6
Lee
Kathy Burke said:

Lee, I tried this but get an IE6 error that a ";" is expected...at
position 15 but that doesn't make sense.

Specifically, from an onclick event in aspx page, I have

Response.Write("<script>var shell=new
ActiveXObject(""WScript.Shell"");shell.Run(""cm d /K CD C:\\Program
Files\\Citrix\\ICA Client\\wfica32.exe ciq.ica"", 1);</script>")

I see the script in the html source when I run it, but I get the error
as mentioned above. Any thoughts?

Thanks for your help.

Kathy

p.s. what does the "1" do at the end of the shell.run line?


In Javascript, you don't nest quotes by doubling them, as you do in VBScript.
Try changing ""WScript.Shell"" to \"Wscript.Shell\"
and the same for the other embedded quotes.
You'll also have to escape every backslash, so all of those instances
of \\ need to change to \\\\

The "1" argument says to show the DOS window:
<http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/wsmthrun.asp>

Jul 20 '05 #7
In article <MP************************@nntp.lucent.com>,
ti******@NOSPAM.comcast.net enlightened us with...
>


It's an oddity with the quotes because of the space in the "Program
Files".
In VBScript, I'd do
shell.Run """C:\\Program Files\\Citrix\\ICA Client\\wfica32.exe
ciq.ica"""

I'm not sure how it goes in JScript. If you can't get it, get the space
out using DOS filename for Program Files with the tilde.

This worked for me with VBScript. If all your users have IE, VBScript is
fine.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
<TITLE>Run Executable HTA</TITLE>
</HEAD>
<body bgcolor=#565656>
<script language="VBScript" type="text/vbscript">
set oShell = CreateObject("WScript.Shell")
oShell.run """C:\Program Files\Microsoft Office\Office\Excel.exe""",1
window.close
</script>
</BODY>
</HTML>
This worked with javascript.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
<TITLE>Run Executable HTA</TITLE>
</HEAD>
<body bgcolor=#565656>
<script language="javascript" type="text/javascript">
var oShell = new ActiveXObject("WScript.Shell");
var prog = "C:\\Program Files\\Microsoft Office\\Office\\Excel.exe";
oShell.run ('"'+prog+'"',1);
window.close();
</script>
</BODY>
</HTML>

--
--
~kaeli~
If a book about failures doesn't sell, is it a success?
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 20 '05 #8
kaeli,

Tried the changes you suggested. Now I get an error that "WScript is
undefined". I've also changed over to using DOS filename.

From the examples I've found on line, this seems like it should work...

sigh...?

Kathy

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 20 '05 #9
Hi again,

Seems to work, but can't find the file. However, when I copy and paste
the file name (as shown below) into the cmd window, it runs the program
as expected.

(note \\ used for javascript)

"c:\\Progra~1\\Citrix\\ICAACLI~1\\wfica32 vbciq.ica"

Does anyone have any idea of where I can look next?

Thanks again.

Kathy

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 20 '05 #10
Ah ha!

Oddly enough I had to set a variable with the full file path for the
target file.

var file = "c:\\progra~1\\Citrix\\ICACLI~1\\vbciq.ica"

oShell.Run("c:\\progra~1\\Citrix\\ICACLI~1\\wfica3 2 " + file,1);

That did it. Thanks for all the help!

Kathy

p.s. I thought using an HTA would mean I WOULDN'T get the open/save
confirmation window when this loads. Any way around that?

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 20 '05 #11
In article <3f***********************@news.frii.net>, kathyburke40
@attbi.com enlightened us with...

p.s. I thought using an HTA would mean I WOULDN'T get the open/save
confirmation window when this loads. Any way around that?


No. According to MS site on HTAs, it is designed that way for security.
--
--
~kaeli~
When you choke a smurf, what color does it turn?
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 20 '05 #12

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
2415
by: Tom Dacon | last post by:
"Open .Net Command Window Here" context menu for Windows Explorer: The reg file described below adds a new menu item to Windows Explorer's context menu when you right-click over a folder (or the...
4
2058
by: Greg Collins [MVP] | last post by:
I've searched around and can't seem to find an answer to this... maybe someone has already done it. I want to create a redirection page for hyperlinks which point to an external site or file. This...
2
2351
by: Jules_Anime | last post by:
Is it possible to create an onclick event which is attached to individual datalist items? I have a Datalist with some details on employees, and when you click on one we would like to open a new...
6
1975
by: slacker | last post by:
In my jsp I have: <Script langauge="Javascript"> window.location.replace("first url"); window.close(); window.open("second url"); </Script> The child window opens from the parent window...
25
3601
by: Tim Zych | last post by:
Is there keystroke combination that will clear the command window in Visual Studio.Net? Or, is there a way for me to clear it in vb.net code, prior to my code running? Thanks.
5
3899
by: hcross | last post by:
This project is a web based html and Javascript site. I am working on mac at the moment. This script works except for attempting to open new window once complete. As you can see, i am new to...
3
2580
by: dsudhakara | last post by:
How to open command window open using php coding
5
5066
by: inetquestion | last post by:
I am looking for a web interface for shell commands or shell scripts. Does anyone know of any exexisting php scripts which would solve this requirement? PHP form accepts input from a user, then...
1
3441
by: SilverGS | last post by:
I want to automatically open a Command Window from the Startup folder in Windows XP. right now after XP starts, I click on Start run, cmd and then when the command window is open I type in a bunch...
0
7324
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,...
1
7042
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7495
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...
1
5052
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...
0
4707
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
3181
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1556
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 ...
1
766
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
418
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.