WScript.Shell doesn't open a program!

Hi, everyone

I created this JavaScript function in my ASP page:

function runReport(repPath)
      var rep = new ActiveXObject("WScript.Shell");
      rep.Run(repPath, 1, true);

it seems to work fine: for example, notepad.exe, winword.exe... every program is opened correctly.
But I have one program, that I need to open my reports, that doesn't work. The error message is "Impossible to find the specified file".
I even added in the local system variable "PATH" the .exe file of this program, but anyway it doesn't work.

What's the matter?

Every help is appreciated.
Thanks in advance
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

are you sure the path is correct. Are you running this function on the server or the client?
aletheia1Author Commented:

Yes, I'm sure that the path is correct... (it's the only one that doesn't work!)

I'm running this function from the client, it's a javascript function...
then the path to that file has to be the path it is on the client currently running the EXE
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

aletheia1Author Commented:
But I want to open a file that is on the server.

This function doesn't accept this syntax?
Hrm, are theres computers on the same network, cause if they arent then you can't do that.

Also wscript can only run .exe, .com, .bat files
aletheia1Author Commented:
Yes, they are on the same network.

>>Also wscript can only run .exe, .com, .bat files
But, even calling the .exe, it gives me the same error message.

Is there other objects instead of WScript.Shell?
aletheia1Author Commented:
I tried this:

var rep = new ActiveXObject("Shell.Application");

But error is: "Authorization denied"...

1) How do you expect to 'run' a file with ext 'rep'????  In other words, what type of a file is that?

2) AFAIK, Wscript only runs on the client

3) "Authorization denied" implies you don't have permissions -- security levels

4) c:\\dirName\\fileName.exe -- if it is not a Windows installed program, you need (at least) double "\\"

5) if you are trying to access a file from an intranet -- assign a drive letter to the server directory; see DOS' SUBST command -- then use that drive letter:  N:\\filename.exe


the only thing vinny is if this is going to run on multiple machines, my N drive might not be the server you mapped for the n drive
If it's an intranet, the N drive should be the same drive for all the clients -- that's what the network supervisor is for -- to make sure mappings are consistent and appropriate
aletheia1Author Commented:
I solved the problem with this syntax:

var rep = new ActiveXObject("WScript.Shell");
var str = new String;
str = "BUSOBJ.EXE \"" + repPath + "\"";
rep.Run(str, 1, true);

I had to call the .exe with the file path and name as parameter.
Now it works perfectly!
Closed, 100 points refunded.

Community Support Moderator
Experts Exchange

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.