From: Rich on 30 Sep 2010 21:59 I have a d:\users folder on my server. inside users, each user has a folder named with their name. inside each of those folders is a desktop folder. I have a file on the C drive that I need to copy to each of those desktop folders, thereby giving each user this shortcut. Does anyone have a script that could do that, instead of me copying this file manually a few hundred times? many thanks if you do!
From: James Whitlow on 2 Oct 2010 13:02 "Rich" <richjone(a)noemail.noemail> wrote in message news:5E68A580-FA4D-4B73-A548-0ED9D74AF34C(a)microsoft.com... > I have a d:\users folder on my server. inside users, each user has a > folder > named with their name. inside each of those folders is a desktop folder. > > I have a file on the C drive that I need to copy to each of those desktop > folders, thereby giving each user this shortcut. Does anyone have a > script > that could do that, instead of me copying this file manually a few hundred > times? many thanks if you do! See if this does what you want: Dim sSourceFile, sDestFolder, oFSO, oFolder, oSubFld sSourceFile = "D:\My File.txt" sDestFolder = "D:\Users Folder" Set oFSO = CreateObject("Scripting.FileSystemObject") Select Case False Case oFSO.FolderExists(sDestFolder) MsgBox sDestFolder & " does not exist!", vbExclamation, _ "ERROR: Destination Folder" WScript.Quit Case oFSO.FileExists(sSourceFile) MsgBox sSourceFile & " does not exist!", vbExclamation, _ "ERROR: Source File" WScript.Quit End Select Set oFolder = oFSO.GetFolder(sDestFolder) For Each oSubFld in oFolder.Subfolders If oFSO.FolderExists(oSubFld & "\Desktop\") Then oFSO.CopyFile sSourceFile, oSubFld & "\Desktop\", True End If Next MsgBox "Complete!"
|
Pages: 1 Prev: Copy file to all users desktop directory Next: Stdregprov decimal return codes? |