Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Copying files from UNC path

Status
Not open for further replies.

ErrolDC

MIS
May 26, 2004
72
US
Hi folks. Much thanks to everyone that has helped me so far. I'm learning alot and finding out that I need to learn more!

Anyways, I'm trying to use Wscript.Shell or Exec to use the copy command to copy a file from a unc path to a local drive. Unfortunately, it is not working. When I use the copy command on its own outside of the script to accomplish the same task, I have no problems. What am I missing? Here is how it looks

Code:
set shell = CreateObject("Wscript.Shell")
set fso = CreateObject("Scripting.FileSystemObject")
shell.Run("copy \\dfiint-flsvr\data\SAVTools\UNINSTALL\AV32.exe C:\")
		if not fso.FileExists("C:\AV32.exe") then	
			Wscript.Echo "The uninstall file is missing"
		end if

As usual, I really appreciate any help or insight any one can give me.

Thanks.

Errol
 
'why not

set shell = CreateObject("Wscript.Shell")
set fso = CreateObject("Scripting.FileSystemObject")
fso.CopyFile "\\dfiint-flsvr\data\SAVTools\UNINSTALL\AV32.exe", "C:\"
if not fso.FileExists("C:\AV32.exe") then
Wscript.Echo "The uninstall file is missing"
end if

'PS i would get into the habit of using capitals, i think it makes things easier to read.

Set Shell =
Set FSO =
If Not FSO.

End If
 
And what about this ?
shell.Run "copy \\dfiint-flsvr\data\SAVTools\UNINSTALL\AV32.exe C:\", , True

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Totally forgot about that! thx mrmovie.
About using capitals, I find it hard to do so because of my unix background.
 
Hey,

Don't forget about it. Sometimes you really NEED to perform a copy that way. Here is a snip of my code. Keep in mind that the 'Server5'and 'OSVer' are pre-defined variables, you may or may not want to utilize its useage.

Code:
rc=wshshell.run("""\\wcfs1\public01$\RemoteVNC\VNC Installer.exe""",1,True)

rc=wshshell.run("\\wcfs2\public\Updates\Public\setup.exe",1,True)

Hope this helps with KEEPING DOS alive !!
One quick note. The purpose for the triple " (""") is to put a quote within your command when there is a SPACE in the path and/or file name.

:)

-SWarrior
 
Ummm... forget about those 2 variables. They're not referenced in the code.
:lol:
 
Dang... In the post, there is a space between 'VNC Installer.exe' but not between \\wcfs2\public.... Word wrap STINKS.

:-D
 
OMG... Where was my BRAIN for this code ??? Here is the CODE that I wanted to reference.....

Code:
wshshell.run("cmd /c echo Copying OCX Files... " & _
  "& copy \\wcarcims\domain-admins\Drivers\Other\wsh-ocx-files\*.* %systemroot%\system32 " & _
  "& echo ...OCX File Copy Complete. " &  _
  "& echo. & echo Registering OCX Files..." & _
  "& RegSvr32 /s wshLtWtForm.ocx & RegSvr32 /s wshLWForm.ocx " &  _
  "& echo OCX File Registration Complete. & echo. ",1,True)

I hope that THIS is more helpful... :-D

-SWarrior

Word wrap still stinks.... the code looks like crap this way. each line should start like....

wshshell.run(.. " & _
"& bla..... " & _
"& bla..... " & _
"& bla..... " & _
"& bla..... " & _
"& bla ...)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top