Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Script help-copy not working

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,63186
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Script help-copy not working
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Script help-copy not working - 8/6/2008 4:58:25 AM   
  ayersrus

 

Posts: 1
Score: 0
Joined: 8/6/2008
Status: offline
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.  Here is the script...
Dim MyPath
Dim oNet
Set oNet = WScript.CreateObject("WScript.Network")
MyFile = "\\MyServer\Dept\DeptDatabase\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\DeptDatabase\FRDB\analyzer.ico"
oLink.Save
msgbox "Please verify that the shortcut 'Reporting Database' is on your PC
Desktop",,"Verify"
 
 
Post #: 1
 
 RE: Script help-copy not working - 8/6/2008 5:13:27 AM   
  mbouchard


Posts: 1916
Score: 16
Joined: 5/15/2003
From: USA
Status: offline
have you tested the command in MyBatCode in a cmd prompt?
Do
Wscript.Echo "cmd.exe /c copy " & MyFile & " " & DestFile

And type the echo into the cmdprompt.

Also, take a look at the WSH docs, see the readme first post, your Run command is missing the wait on return.

_____________________________

Mike

For useful Scripting links see the Read Me First stickey!

Always remember Search is your friend.

(in reply to ayersrus)
 
 
Post #: 2
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Script help-copy not working Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts