如果要往 system32 拷贝内容,系统是不允许的。需要这样变通
Dim s As String = Date.now
Dim fstr As String = "e:\test.txt"
Dim f As String = SpecialFolder.SYSTEM & "\test.txt"
Dim fcmd As String = "e:\test.bat"
FileSys.WriteAllText(fstr, s, False)
FileSys.WriteAllText(fcmd, "copy " & fstr & " " & f & " /y", False, encoding.default)
'FileSys.WriteAllText(fcmd, "copy " & fstr & " " & f & " /y" & vbcrlf & "pause", False, encoding.default)
System.Diagnostics.Process.Start("Explorer", " /select," & fcmd & " ")
system.threading.thread.sleep(1000)
Sendkeys.Send("{enter}")
当然,如果你用代码直接拷贝,会存放到 syswow64 文件夹