G
Guest
I'm using the following VBS to hide/unhide a folder:
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder("C:\FSO")
If objFolder.Attributes = objFolder.Attributes AND 2 Then
objFolder.Attributes = objFolder.Attributes XOR 2
End If
My question is how do I get the script to only run if the folder is not
hidden (i.e. the folder is already set to HIDDEN and I don't want to unhide
it)? When I run the script in succession it hides/unhides each time. I want
the script to only hide the folder if it is not already hidden. Also, I
would like all subdirectories and files to be hidden as well if they are not
already. Any help would be greatly appreciated. Please be patient with me
as I am totally new at this VBS thing. I'll try to not be too much of a pain.
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder("C:\FSO")
If objFolder.Attributes = objFolder.Attributes AND 2 Then
objFolder.Attributes = objFolder.Attributes XOR 2
End If
My question is how do I get the script to only run if the folder is not
hidden (i.e. the folder is already set to HIDDEN and I don't want to unhide
it)? When I run the script in succession it hides/unhides each time. I want
the script to only hide the folder if it is not already hidden. Also, I
would like all subdirectories and files to be hidden as well if they are not
already. Any help would be greatly appreciated. Please be patient with me
as I am totally new at this VBS thing. I'll try to not be too much of a pain.