Hello,

I use VBScript to execute an application on a network drive.

The script looks like this:

<-----------------
const cFolder = "S:\Apps\MyProg"
const cPrg = "prg.exe"
set oShell = CreateObject("WScript.Shell")
with oShell
.CurrentDirectory = cFolder
call .Run(cFolder & "\" & cPrg)
end with
<-----------------

With some users, this script fails executing "call .Run()" with error
800A0046 - Permission denied.

If I replace "call .Run()" with "call .Exec()" using exact the same parameter,
the same user can run the script without any problems.

What is the difference between .Exec and .Run?
Why does .Run fail sometimes?

Thank you very much,
Josef

Re: Error 800A0046 with Shell.Run, but .Exec works by Nathan

Nathan
Thu Nov 01 17:17:33 PDT 2007

On Oct 23, 3:57 pm, Josef Lindinger <selis...@nospam.nospam> wrote:
> Hello,
>
> I use VBScript to execute an application on a network drive.
>
> The script looks like this:
>
> <-----------------
> const cFolder = "S:\Apps\MyProg"
> const cPrg = "prg.exe"
> set oShell = CreateObject("WScript.Shell")
> with oShell
> .CurrentDirectory = cFolder
> call .Run(cFolder & "\" & cPrg)
> end with
> <-----------------
>
> With some users, this script fails executing "call .Run()" with error
> 800A0046 - Permission denied.
>
> If I replace "call .Run()" with "call .Exec()" using exact the same parameter,
> the same user can run the script without any problems.
>
> What is the difference between .Exec and .Run?
> Why does .Run fail sometimes?
>
> Thank you very much,
> Josef

This block:

> with oShell
> .CurrentDirectory = cFolder
> call .Run(cFolder & "\" & cPrg)
> end with

Should read:

> with oShell
> cFolder = .CurrentDirectory
> .Run cFolder & "\" & cPrg
> end with

-Nate
http://www.naterice.com/


Re: Error 800A0046 with Shell.Run, but .Exec works by selisoft

selisoft
Sat Nov 10 06:48:00 PST 2007

Hello Nathan,

thank you for answering.
My program works with .Exec, but not with .Run. I wanted to know why .Run
gives error 800A0046 and .Exec works.

Regards,
Josef


"Nathan" wrote:

> On Oct 23, 3:57 pm, Josef Lindinger <selis...@nospam.nospam> wrote:
> > Hello,
> >
> > I use VBScript to execute an application on a network drive.
> >
> > The script looks like this:
> >
> > <-----------------
> > const cFolder = "S:\Apps\MyProg"
> > const cPrg = "prg.exe"
> > set oShell = CreateObject("WScript.Shell")
> > with oShell
> > .CurrentDirectory = cFolder
> > call .Run(cFolder & "\" & cPrg)
> > end with
> > <-----------------
> >
> > With some users, this script fails executing "call .Run()" with error
> > 800A0046 - Permission denied.
> >
> > If I replace "call .Run()" with "call .Exec()" using exact the same parameter,
> > the same user can run the script without any problems.
> >
> > What is the difference between .Exec and .Run?
> > Why does .Run fail sometimes?
> >
> > Thank you very much,
> > Josef
>
> This block:
>
> > with oShell
> > .CurrentDirectory = cFolder
> > call .Run(cFolder & "\" & cPrg)
> > end with
>
> Should read:
>
> > with oShell
> > cFolder = .CurrentDirectory
> > .Run cFolder & "\" & cPrg
> > end with
>
> -Nate
> http://www.naterice.com/
>
>