Problem with path

N

no stress

I'm trying to run a program from the script below. For some reason the
script wants the full path to the executable. Since it will be running on a
CD, I don't know what the drive letter is. Can someone help with the path?
Again it work when I put the full path...runCmd('c:/../addprinter.exe');
The error is 'The system cannot find the file specified".
I did not include all of the header stuff.

<script language="javascript" type="text/javascript">
function runCmd(cmd)
{
var shell=new ActiveXObject("WScript.shell");
shell.run(cmd,1);
}
</script>

<input type="Button" value="abc" onclick="runCmd('addprinter.exe')">
 
J

Jens Peter Karlsen[FP MVP]

If the file is not in the PATH or in the same directory as the script
you must supply a path to it. If it is on the same drive, the path can
be relative otherwise it must be absolute.

Regards Jens Peter Karlsen. Microsoft MVP - Frontpage.
 
N

no stress

Re: Problem with pathThanks. This is new to me. My structure is like this.

x:\root\image\html\htmlpages\working.htm
x:\root\image\driver\program.exe

I was thinking it would work like dos...ie runProg('../driver/program.exe') since it was be called from th htmlpages folder.

But it is working from the root....runProg('./image/driver/program.exe')


If the file is not in the PATH or in the same directory as the script you must supply a path to it. If it is on the same drive, the path can be relative otherwise it must be absolute.

Regards Jens Peter Karlsen. Microsoft MVP - Frontpage.
 
R

Ronx

Shouldn't runProg('../driver/program.exe')
be runProg('../../driver/program.exe')
?
--
Ron Symonds
Microsoft MVP (FrontPage)
Reply only to group - emails will be deleted unread.

"no stress" <nospamplease.com> wrote in message
Re: Problem with pathThanks. This is new to me. My structure is like
this.

x:\root\image\html\htmlpages\working.htm
x:\root\image\driver\program.exe

I was thinking it would work like dos...ie
runProg('../driver/program.exe') since it was be called from th
htmlpages folder.

But it is working from the
root....runProg('./image/driver/program.exe')


If the file is not in the PATH or in the same directory as the
script you must supply a path to it. If it is on the same drive, the
path can be relative otherwise it must be absolute.

Regards Jens Peter Karlsen. Microsoft MVP - Frontpage.
 
J

Jens Peter Karlsen[FP MVP]

It does work like DOS but you don't seem to remember the rules too well.
The first example would work if the calling page was in the html folder
and it isn't ../ means go one folder back. The other works because ./
means current folder.
In your first example you could use ../../ to go to folders back but you
may find it easier to always start at the root like this:
/root/image/driver/program.exe

Regards Jens Peter Karlsen. Microsoft MVP - Frontpage.

________________________________

From: no stress [mailto:nospamplease.com]
Posted At: 1. april 2005 22:37
Posted To: microsoft.public.frontpage.programming
Conversation: Problem with path
Subject: Re: Problem with path


Thanks. This is new to me. My structure is like this.

x:\root\image\html\htmlpages\working.htm
x:\root\image\driver\program.exe

I was thinking it would work like dos...ie
runProg('../driver/program.exe') since it was be called from th
htmlpages folder.

But it is working from the
root....runProg('./image/driver/program.exe')



in message
If the file is not in the PATH or in the same directory
as the script you must supply a path to it. If it is on the same drive,
the path can be relative otherwise it must be absolute.

Regards Jens Peter Karlsen. Microsoft MVP - Frontpage.
-----Original Message-----
From: no stress [mailto:nospamplease.com]
Posted At: 1. april 2005 15:18
Posted To: microsoft.public.frontpage.programming
Conversation: Problem with path
Subject: Problem with path


I'm trying to run a program from the script below. For some
reason the script wants the full path to the executable.
Since it will be running on a CD, I don't know what the drive
letter is. Can someone help with the path?
Again it work when I put the full
path...runCmd('c:/../addprinter.exe');
The error is 'The system cannot find the file specified".
I did not include all of the header stuff.

<script language="javascript" type="text/javascript">
function runCmd(cmd) { var shell=new
ActiveXObject("WScript.shell"); shell.run(cmd,1); }
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top