I need to copy a folder from the network with a program in it. After it has
been copyed to the C: it must run the setup file. I can copy it, but cant
find the right command to get it to run. Here is my script:

------------------
Set fs = CreateObject ("Scripting.FileSystemObject")
fs.CopyFolder "\\Ask\Programmer\NetscreenKlient", "C:\NetscreenKlient"
ws.Run ("C:\NetscreenKlient\Setup\setup.exe")
------------------

The ws.Run command is where the error is. What should i use instead. Or do
anyone have another way to do this.

Best regards
Jesper
Denmark

Re: Copy and install by C

C
Thu Mar 10 09:28:21 CST 2005

Have you created ws by

set ws = CreateObject("Wscript.Shell")



Re: Copy and install by Torgeir

Torgeir
Thu Mar 10 09:28:27 CST 2005

js wrote:

> I need to copy a folder from the network with a program in it. After it has
> been copyed to the C: it must run the setup file. I can copy it, but cant
> find the right command to get it to run. Here is my script:
>
> ------------------
> Set fs = CreateObject ("Scripting.FileSystemObject")
> fs.CopyFolder "\\Ask\Programmer\NetscreenKlient", "C:\NetscreenKlient"
> ws.Run ("C:\NetscreenKlient\Setup\setup.exe")
> ------------------
>
> The ws.Run command is where the error is. What should i use instead. Or do
> anyone have another way to do this.
Hi

You need to define the ws object before you use it (ws.Run):

Set ws = CreateObject("WScript.Shell")


--
torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway
Administration scripting examples and an ONLINE version of
the 1328 page Scripting Guide:
http://www.microsoft.com/technet/scriptcenter/default.mspx