In DOS esiste il pratico comando ATTRIB:
http://www.microsoft.com/technet/prodtechnol/windowsserver2003/it/library/ServerHelp/56202570-64a8-424b-8a11-09f5b8584cab.mspx?mfr=true
In WSH invece è possibile ricorrere ad un codice del tipo che imposta l'attributo Archive per un singolo file o per tutti i file in una directory e relative subdirectory:
WSH.echo ToggleArchiveBit("F:\test.txt")
SetArchiveBit("F:\Test")
Function ToggleArchiveBit(filePath)
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.GetFile(filePath)
If objFile.Attributes And 32 then
objFile.Attributes = objFile.Attributes XOR 32
ToggleArchiveBit = "Archive bit is cleared."
Else
objFile.Attributes = objFile.Attributes XOR 32
ToggleArchiveBit = "Archive bit is set."
End If
End Function
Function SetArchiveBit(Path)
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder(Path)
Set colSubfolders = objFolder.Subfolders
For Each objSubfolder in colSubfolders
SetArchiveBit(objSubfolder.Path)
Next
Set colFiles = objFolder.Files
For Each objFile in colFiles
If Not objFile.Attributes And 32 then
objFile.Attributes = objFile.Attributes XOR 32
End If
Next
End Function
Ovviamente il codice è adattabile anche ad altri attributi per maggiori info:
http://www.microsoft.com/technet/scriptcenter/guide/sas_scr_elex.mspx
http://www.microsoft.com/technet/scriptcenter/guide/sas_scr_owhk.mspx
http://www.microsoft.com/technet/scriptcenter/guide/sas_scr_brxn.mspx
http://www.microsoft.com/technet/scriptcenter/guide/sas_scr_jozd.mspx