Wscript.shell Run doesn't work 
Author Message
 Wscript.shell Run doesn't work

I'm trying to run an exe from a VBScript the following way:

dim Wshshell
set WshShell = CreateObject("WScript.Shell")
WshShell.Run ("c:\somedir\someprogram.exe")

but nomatter what I do it doesn't work. Have tried the "cmd.exe
c:\somedir\someprogram.exe" but that doesn't work either. It doesn't make
any difference wheter I run the shell with or without a return value.

 If I go to the dir using the DOS prompt, and run the program manually, it
works fine, and same thing happens if I use explorer to open up the dir and
run the file. If I place another exe in the same dir (label.exe) it runs
fine. I use NT 4.0.   The funny thing is, that if I keep the task manager
open while running the script, I can see the program come up correctly in
the lineup of tasks, but it still doesn't work. It's supposed to use one on
input file and make 3 small output files - has this got anything to do with
the problem ??

Thanks in advance
Toke



Sat, 16 Aug 2003 05:57:35 GMT  
 Wscript.shell Run doesn't work
I have ran into the same problem in the past while running a {*filter*} server.
How I got around it was to create a batch file with the execute commands for
the dos file in there.  This solved the problem and allowed me to run it as
a service :)

Later
Bryan Martin


Quote:
> I'm trying to run an exe from a Vbscript the following way:

> dim Wshshell
> set WshShell = CreateObject("WScript.Shell")
> WshShell.Run ("c:\somedir\someprogram.exe")

> but nomatter what I do it doesn't work. Have tried the "cmd.exe
> c:\somedir\someprogram.exe" but that doesn't work either. It doesn't make
> any difference wheter I run the shell with or without a return value.

>  If I go to the dir using the DOS prompt, and run the program manually, it
> works fine, and same thing happens if I use explorer to open up the dir
and
> run the file. If I place another exe in the same dir (label.exe) it runs
> fine. I use NT 4.0.   The funny thing is, that if I keep the task manager
> open while running the script, I can see the program come up correctly in
> the lineup of tasks, but it still doesn't work. It's supposed to use one
on
> input file and make 3 small output files - has this got anything to do
with
> the problem ??

> Thanks in advance
> Toke



Sat, 16 Aug 2003 09:52:49 GMT  
 Wscript.shell Run doesn't work
Could be the default directory in the context of the run command doesn't
allow it to find the input file.


Quote:
> I'm trying to run an exe from a Vbscript the following way:

> dim Wshshell
> set WshShell = CreateObject("WScript.Shell")
> WshShell.Run ("c:\somedir\someprogram.exe")

> but nomatter what I do it doesn't work. Have tried the "cmd.exe
> c:\somedir\someprogram.exe" but that doesn't work either. It doesn't make
> any difference wheter I run the shell with or without a return value.

>  If I go to the dir using the DOS prompt, and run the program manually, it
> works fine, and same thing happens if I use explorer to open up the dir
and
> run the file. If I place another exe in the same dir (label.exe) it runs
> fine. I use NT 4.0.   The funny thing is, that if I keep the task manager
> open while running the script, I can see the program come up correctly in
> the lineup of tasks, but it still doesn't work. It's supposed to use one
on
> input file and make 3 small output files - has this got anything to do
with
> the problem ??

> Thanks in advance
> Toke



Sat, 16 Aug 2003 12:09:50 GMT  
 Wscript.shell Run doesn't work


Fri, 19 Jun 1992 00:00:00 GMT  
 Wscript.shell Run doesn't work
It still doesn't work - but just for the fun of it, tried to write a bat
file going (from root):
cd somedir
cd someotherdir
FileIWantToRun.exe

and that worked out ?? So it seems like I need to change the current path
somehow (which isn't done by using
WshShell.Run("c:\somedir\SomeOtherDir\FileRun.exe")
but how do I do this ?? Tried the ChDir from VB but it doesn't work
Toke


Quote:
> I have ran into the same problem in the past while running a {*filter*}
server.
> How I got around it was to create a batch file with the execute commands
for
> the dos file in there.  This solved the problem and allowed me to run it
as
> a service :)

> Later
> Bryan Martin



> > I'm trying to run an exe from a Vbscript the following way:

> > dim Wshshell
> > set WshShell = CreateObject("WScript.Shell")
> > WshShell.Run ("c:\somedir\someprogram.exe")

> > but nomatter what I do it doesn't work. Have tried the "cmd.exe
> > c:\somedir\someprogram.exe" but that doesn't work either. It doesn't
make
> > any difference wheter I run the shell with or without a return value.

> >  If I go to the dir using the DOS prompt, and run the program manually,
it
> > works fine, and same thing happens if I use explorer to open up the dir
> and
> > run the file. If I place another exe in the same dir (label.exe) it runs
> > fine. I use NT 4.0.   The funny thing is, that if I keep the task
manager
> > open while running the script, I can see the program come up correctly
in
> > the lineup of tasks, but it still doesn't work. It's supposed to use one
> on
> > input file and make 3 small output files - has this got anything to do
> with
> > the problem ??

> > Thanks in advance
> > Toke



Sun, 17 Aug 2003 05:51:07 GMT  
 Wscript.shell Run doesn't work
WScript 5.6 beta 1 has a new WshShell.CurrentDirectory property to do exactly that...

--
Michael Harris
Microsoft.MVP.Scripting
--

Please do not email questions - post them to the newsgroup instead.
--


Quote:
> It still doesn't work - but just for the fun of it, tried to write a bat
> file going (from root):
> cd somedir
> cd someotherdir
> FileIWantToRun.exe

> and that worked out ?? So it seems like I need to change the current path
> somehow (which isn't done by using
> WshShell.Run("c:\somedir\SomeOtherDir\FileRun.exe")
> but how do I do this ?? Tried the ChDir from VB but it doesn't work
> Toke



> > I have ran into the same problem in the past while running a {*filter*}
> server.
> > How I got around it was to create a batch file with the execute commands
> for
> > the dos file in there.  This solved the problem and allowed me to run it
> as
> > a service :)

> > Later
> > Bryan Martin



> > > I'm trying to run an exe from a Vbscript the following way:

> > > dim Wshshell
> > > set WshShell = CreateObject("WScript.Shell")
> > > WshShell.Run ("c:\somedir\someprogram.exe")

> > > but nomatter what I do it doesn't work. Have tried the "cmd.exe
> > > c:\somedir\someprogram.exe" but that doesn't work either. It doesn't
> make
> > > any difference wheter I run the shell with or without a return value.

> > >  If I go to the dir using the DOS prompt, and run the program manually,
> it
> > > works fine, and same thing happens if I use explorer to open up the dir
> > and
> > > run the file. If I place another exe in the same dir (label.exe) it runs
> > > fine. I use NT 4.0.   The funny thing is, that if I keep the task
> manager
> > > open while running the script, I can see the program come up correctly
> in
> > > the lineup of tasks, but it still doesn't work. It's supposed to use one
> > on
> > > input file and make 3 small output files - has this got anything to do
> > with
> > > the problem ??

> > > Thanks in advance
> > > Toke



Sun, 17 Aug 2003 09:57:39 GMT  
 Wscript.shell Run doesn't work


Fri, 19 Jun 1992 00:00:00 GMT  
 Wscript.shell Run doesn't work
Hope this is not too late for you. But I believe it's a synntax error. if
you specify a path in run, then you will need ' '

so the line of code will be :

WshShell.Run ('"c:\somedir\someprogram.exe"')

took me a while to figure that one out =p

Hannah

--
Posted via CNET Help.com
http://www.help.com/



Tue, 02 Sep 2003 03:30:05 GMT  
 
 [ 8 post ] 

 Relevant Pages 

1. WScript.Shell Run Doesn't Work???

2. WScript.GetObject doesn't get running Word App

3. WScript.GetObject doesn't get running Word App

4. Runs, doesn't work..

5. Shell command doesn't work under WinNT

6. shell - why doesn't this work

7. Why doesn't this Shell command work?

8. Shelling .HTM under NT Doesn't Work

9. Advanced : Shell doesn't appear to be running asynchronously

10. fRefreshLinks Doesn't work if path doesn't exist

11. If Field IsNull Then Go to Next Field And Run - Doesn't work HELP

12. Report works 1st time run, then doesn't any more

 

 
Powered by phpBB® Forum Software