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

Copying to all users desktop

Status
Not open for further replies.

redlair

Technical User
Jun 29, 2004
54
0
0
US

I am still having problems copying a file(.lnk) to the all users desktop. Acualy I get the same error when copying to any profile folder. The OS is XP and the error is "Permission denied". All I am doing is a simple Fso.Copyfile, I do not understand. I can copy to other folders on in the system.

'''''''''''''''''''''''''''''''''''''''''''''''''''

Dim FSO, WshShell, StrDesktop, MyFile

Set FSO =CreateObject("scripting.FileSystemObject")

Set WshShell = WScript.CreateObject("WScript.Shell")
strDesktop = WshShell.SpecialFolders("Desktop")
FSO.CopyFile "C:\Microtype_Network.lnk", strDesktop

wsh.echo StrDesktop

'Set MyFile = fso.GetFile("L:\Microtype_Network.lnk")
'MyFile.Copy ("C:\Documents and Settings\All Users\Desktop")
 
>[tt]FSO.CopyFile "C:\Microtype_Network.lnk", strDesktop[/tt]
[tt]FSO.CopyFile "C:\Microtype_Network.lnk", strDesktop [red]& "\"[/red][/tt]
In case it fails still, make sure that if the destination exists before copyfile, that file is not having read-only attribute. If it does, either delete it or eliminate the read-only attribute before doing the copyfile. If it is a general worry, script this operation as well.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top