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

Script to backup file and export favorites 1

Status
Not open for further replies.

butkus

MIS
Sep 4, 2001
114
US
Does anyone have a script that will export a users favorites (from a W2K machine) and also copy files to a network location?

I'm not a programmer, and therefore have no idea how to begin scripting this. The problem I see with scripting a traditional copy (for favorites) is that more than one user could have used the networked computer at some time, and created their own user profile. How then do you have the script just copy for the user logged in if multiple profiles exist. As always, anything will help.

Thanks
James
 
'start script

Dim onet, ofso
'create network object
Set onet = CreateObject("wscript.network")

'create file system objects
set ofso = CreateObject("scripting.filesystemobject")

'copy favorites folder of current logged on user to c:\temp
call ofso.CopyFolder("C:\Documents and Settings\"&onet.UserName&"\Favorites","c:\temp\")

'destroy objects
set ofso = nothing
set onet = nothing

'end script

of couse you would replace "c:\temp\" with your desired sourse. You might need to use a system variable for the documents and folder location since it may be different on each computer, but IM not sure that that is, or is one even exsist. Hope this helps.
 
use this instead, it will use the system variables:

'begin script
Dim onet, ofso, oshell
Set onet = CreateObject("wscript.network")
Set oshell = CreateObject("wscript.shell")
Set ofso = CreateObject("scripting.filesystemobject")
call ofso.CopyFolder(oshell.SpecialFolders.item("Favorites"),"c:\temp\")
set oNet = nothing
set oShell = nothing
set ofso = nothing

'end script

still need to replace c:\temp with desired source though
 
Both examples work like a champ. Thank you both
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top