473,289 Members | 2,141 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,289 software developers and data experts.

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 78026
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
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
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
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
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
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
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
by: dsudhakara | last post by:
How to open command window open using php coding
5
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
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
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...

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.