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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I'm trying to use the copyfile comm

Status
Not open for further replies.

DaveNamou

IS-IT--Management
Feb 7, 2002
175
US
I'm trying to use the copyfile command as shown below.
- I keep getting an "Access Denied" Error.
- I'm not logged on as Administrator but I do have Admin rights to the box.
- The inputbox always me to cut and paste the exact command that the script would use into a command prompt. I run the output form the input box into a command prompt and it works fine.

==============SCRIPT====================
Dim fso
Set fso = CreateObject("Scripting.FileSystemObject")

strCopySource = "\\SERVER01\Drivers$\Temp\test.txt"
strCopyDest = "\\SERVER02\O$\winnt\profiles\Administrator\Windows"

'inputbox "test","test", "Copy " & strCopySource & " " & strCopyDest

fso.CopyFile strCopySource, strCopyDest
===================End File============

Can anyone give me some ideas as to why this isn't working? Dave Namou, MCSE CCEA
 
Dave,

I don't think you can start your paths with "\\..." they need a drive letter "C:\..."

To copy acrosss servers you will have to set up a shared directory.

BDC.
 
Actually, the FSO does support UNC pathes. So if share & file permissions are configured correctly, you should have no problem.

You state you have Admin rights on the box, but there appears to be two servers at play here - Server01 and Server02. Can you perform the copy/paste operation thru Windows Explorer? Jon Hawkins
 
Sorry, I didn't previously comprehend your third bullet.

The reason it fails is because it's attempting to create a file named windows in the Administrator folder and I'm presuming there is already a subfolder named Windows.

Try

strCopyDest = "\\SERVER02\O$\winnt\profiles\Administrator\Windows\" Jon Hawkins
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top