Link to home
Start Free TrialLog in
Avatar of hoshie329
hoshie329Flag for Afghanistan

asked on

VBScript File Copy and Rename

I am working on a script to copy and rename a file, i am getting an error on the last line.. mismatch..'FileCopy', I am not sure what i have wrong
Dim Location
Dim BackupLocation
Dim FileName
Dim BacupFileName 
DIM strComputer
DIM PCName                                       

strComputer = "." 
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2") 
Set colItems = objWMIService.ExecQuery( _
    "SELECT * FROM Win32_ComputerSystem",,48)<wbr ></wbr> 
For Each objItem In colItems 
    PCName = objItem.Name
Next


Location = "C:\Program Files\ProgramFolder\SubFolder\SubSubFolder"
BackupLocation =  "y:\SOuser"
FileName="users.xml"
BacupFileName = PCName & ".xml"

FileCopy Location & "\" & FileName, BackupLocation & "\" & BacupFileName

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Bill Prew
Bill Prew

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of hoshie329

ASKER

This worked perfectly, Thank You
Avatar of Bill Prew
Bill Prew

Great, glad that's all it was. thanks for the feedback.

~bp