Wensi said:
Hello,
How to have a VBscript or batch file to copy a hidden file from a server to
a remote server?
Copied and tweaked from portable script center:
"Copying a File",
"Enumerating File Attributes" and
"Modifying File Atttributes""
'---------------------------------------------------
Dim Src, Dest, SrcAtt
Src="\\Server1\c$\boot.ini"
Dest="\\Server2\c$\boot2.ini"
Set objFSO = CreateObject("Scripting.FileSystemObject")
'copy file
Const OverwriteExisting = True
objFSO.CopyFile Src ,Dest , OverwriteExisting
' get source attributes
Set objFile = objFSO.GetFile(Src)
SrcAtt = objFile.Attributes
' set dest attributes
Set objFile = objFSO.GetFile(Dest)
objFile.Attributes = SrcAtt
set objFile = Nothing
'---------------------------------------------------
HTH