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!

Scipt not copying file 1

Status
Not open for further replies.

ayersrus

MIS
Aug 6, 2008
2
US
Need some help with this script. It is supposed to install a copy of the frdb.mdb,

which is a shell, to all users folder and then place a shortcut on the desktop.

For some reason the .mdb is not copying to the All Users folder. Thanks.

Dim MyPath
Dim oNet
Set oNet = WScript.CreateObject("WScript.Network")

MyFile = "\\MyServer\Dept\Dept Database\FRDB.mdb"
'DestFile = "c:\docume~1\" & oNet.userName & "\desktop\*.*"
DestFile = "c:\docume~1\alluse~1\FRDB.mdb"
MyBatCode = "cmd.exe /c copy " & MyFile & " " & DestFile

Set objShell = CreateObject("WScript.Shell")
objshell.run(mybatcode)

Set oWS = WScript.CreateObject("WScript.Shell")
sLinkFile = "c:\docume~1\alluse~1\desktop\Reporting Database.LNK"
Set oLink = oWS.CreateShortcut(sLinkFile)
oLink.Targetpath = "c:\docume~1\alluse~1\FRDB.mdb"
oLink.Description = "Reporting Database"
oLink.IconLocation = "\\MyServer\Dept\Dept Database\FRDB\analyzer.ico"
oLink.Save

msgbox "Please verify that the shortcut 'Reporting Database' is on your PC

Desktop",,"Verify
 
Code:
MyBatCode = "cmd.exe /c copy [!]""[/!]" & MyFile & "[!]""[/!] " & DestFile

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Thanks. That worked! But I noticed that it is no longer read only. Any ideas on how to keep this attribute?
 
MyBatCode = "cmd.exe /c copy """ & MyFile & """ " & DestFile & " & attrib +R " & DestFile

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top